After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793288 - "fatal error: libmount/libmount.h: No such file or directory" when libmount is installed in some non-default prefix
"fatal error: libmount/libmount.h: No such file or directory" when libmount i...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
2.55.x
Other Linux
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-02-08 02:07 UTC by Alexander Mezin
Modified: 2018-02-13 15:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Drop fallback checks for libmount versions without pkg-config (3.41 KB, patch)
2018-02-12 12:18 UTC, Philip Withnall
committed Details | Review
build: Remove incorrect to_int() calls in meson.build (1.06 KB, patch)
2018-02-12 12:31 UTC, Philip Withnall
committed Details | Review

Description Alexander Mezin 2018-02-08 02:07:05 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.
Comment 1 Philip Withnall 2018-02-09 12:05:35 UTC
What’s the output from running `make` with `V=1`; i.e. the actual compiler command line?
Comment 2 Alexander Mezin 2018-02-12 04:10:10 UTC
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.
Comment 3 Alexander Mezin 2018-02-12 04:14:41 UTC
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
Comment 4 Philip Withnall 2018-02-12 12:18:02 UTC
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>
Comment 5 Philip Withnall 2018-02-12 12:31:33 UTC
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>
Comment 6 Matthias Clasen 2018-02-13 13:37:05 UTC
Review of attachment 368255 [details] [review]:

looks fine. Thanks for doing all the distro checking
Comment 7 Matthias Clasen 2018-02-13 13:37:45 UTC
Review of attachment 368256 [details] [review]:

ok
Comment 8 Philip Withnall 2018-02-13 14:18:10 UTC
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
Comment 9 Philip Withnall 2018-02-13 15:01:27 UTC
(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.