GNOME Bugzilla – Bug 793288
"fatal error: libmount/libmount.h: No such file or directory" when libmount is installed in some non-default prefix
Last modified: 2018-02-13 15:01:27 UTC
/home/amezin/glib-2.55.0/gio/gunixmounts.c:162:31: fatal error: libmount/libmount.h: No such file or directory #include <libmount/libmount.h> In config.log: LIBMOUNT_CFLAGS='-I/home/amezin/util-linux/install/include/libmount -I/home/amezin/util-linux/install/include/blkid -I/home/amezin/util-linux/install/include/uuid ' In mount.pc: includedir=/home/amezin/util-linux/install/include Cflags: -I${includedir}/libmount So #include looks like /home/amezin/util-linux/install/include should be in include paths, but pkg-config returns -I/home/amezin/util-linux/install/include/libmount in cflags.
What’s the output from running `make` with `V=1`; i.e. the actual compiler command line?
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I/home/amezin/test_glib0/glib/src/glib-2.55.2/gio -I.. -I/home/amezin/test_glib0/zlib/install/include -DG_LOG_DOMAIN=\"GLib-GIO\" -I.. -I../glib -I/home/amezin/test_glib0/glib/src/glib-2.55.2/glib -I/home/amezin/test_glib0/glib/src/glib-2.55.2 -I/home/amezin/test_glib0/glib/src/glib-2.55.2/gmodule -DG_ENABLE_DEBUG -DGIO_COMPILATION -DGIO_MODULE_DIR=\"/home/amezin/test_glib0/glib/install/lib/gio/modules\" -pthread -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -Werror=missing-include-dirs -fvisibility=hidden -I/home/amezin/test_glib0/util-linux/install/include/libmount -I/home/amezin/test_glib0/util-linux/install/include/blkid -I/home/amezin/test_glib0/util-linux/install/include/uuid -g -O2 -fno-strict-aliasing -MT libgio_2_0_la-gunixvolumemonitor.lo -MD -MP -MF .deps/libgio_2_0_la-gunixvolumemonitor.Tpo -c /home/amezin/test_glib0/glib/src/glib-2.55.2/gio/gunixvolumemonitor.c -fPIC -DPIC -o .libs/libgio_2_0_la-gunixvolumemonitor.o mv -f .deps/libgio_2_0_la-gunixfdmessage.Tpo .deps/libgio_2_0_la-gunixfdmessage.Plo /home/amezin/test_glib0/glib/src/glib-2.55.2/gio/gunixmounts.c:162:31: fatal error: libmount/libmount.h: No such file or directory #include <libmount/libmount.h> ^ compilation terminated. (build paths are different from the original report, sorry) My current workaround is adding CPPFLAGS=-I/home/amezin/test_glib0/util-linux/install/include . With this environment variable the build succeeds.
Oops, that command line was for the wrong file. Though all flags are the same for gunixmounts.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I/home/amezin/test_glib0/glib/src/glib-2.55.2/gio -I.. -I/home/amezin/test_glib0/zlib/install/include -DG_LOG_DOMAIN=\"GLib-GIO\" -I.. -I../glib -I/home/amezin/test_glib0/glib/src/glib-2.55.2/glib -I/home/amezin/test_glib0/glib/src/glib-2.55.2 -I/home/amezin/test_glib0/glib/src/glib-2.55.2/gmodule -DG_ENABLE_DEBUG -DGIO_COMPILATION -DGIO_MODULE_DIR=\"/home/amezin/test_glib0/glib/install/lib/gio/modules\" -pthread -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -Werror=missing-include-dirs -fvisibility=hidden -I/home/amezin/test_glib0/util-linux/install/include/libmount -I/home/amezin/test_glib0/util-linux/install/include/blkid -I/home/amezin/test_glib0/util-linux/install/include/uuid -g -O2 -fno-strict-aliasing -MT libgio_2_0_la-gunixmounts.lo -MD -MP -MF .deps/libgio_2_0_la-gunixmounts.Tpo -c /home/amezin/test_glib0/glib/src/glib-2.55.2/gio/gunixmounts.c -fPIC -DPIC -o .libs/libgio_2_0_la-gunixmounts.o
Created attachment 368255 [details] [review] build: Drop fallback checks for libmount versions without pkg-config Building against libmount installed into a non-default prefix wasn’t working, as we were using #include <libmount/libmount.h> rather than the correct #include <libmount.h> — all the mount.pc pkg-config files set `Cflags: -I${includedir}/libmount`. Fixing this while retaining the fallback support for versions of libmount without a pkg-config file would have been tricky (we would need to work out a suitable -I flag to set in LIBMOUNT_CFLAGS) to still be able to use the correct #include path). Thankfully, libmount gained pkg-config support a long time ago, so I think we can safely drop the fallback code. In particular, Debian Jessie, Ubuntu Trusty, and CentOS 5 all ship a mount.pc file. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Created attachment 368256 [details] [review] build: Remove incorrect to_int() calls in meson.build They’re called on assignment to these variables. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Review of attachment 368255 [details] [review]: looks fine. Thanks for doing all the distro checking
Review of attachment 368256 [details] [review]: ok
Thanks for the review! Attachment 368255 [details] pushed as b716660 - build: Drop fallback checks for libmount versions without pkg-config Attachment 368256 [details] pushed as 04b3ce7 - build: Remove incorrect to_int() calls in meson.build
(In reply to Philip Withnall from comment #8) > Attachment 368255 [details] pushed as b716660 - build: Drop fallback checks > for libmount versions without pkg-config This broke the build on Continuous, which apparently ships util-linux 2.27 without a mount.pc file. Emmanuele is looking at the recipe to see why there is no pkg-config file there (since util-linux definitely shipped with mount.pc). While looking at this, we noticed that the libmount dependency had been accidentally raised from 2.23 to 2.28 since commit 96ebcee8c4, so I’ve pushed commit 35d5add4bb65984b428d47d40ace1e2c2d22c2b5 to fix that.