nilfs-utils: fix build with static toolchains
PATCH 1/1 nilfs-utils: fix build with static toolchains
This commit adds a patch to respect the dependency libmount->libblkid->libuuid properly in autoconf. This becomes necessary for static builds.
--- ...nt-libblkid-fix-order-of-autoconf-probing.patch | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch new file +62 -0
@@ -0,0 +1,62 @@ +From 94732d03c5361a9f8f9d0f018e0fd9850a2c7d29 Mon Sep 17 00:00:00 2001 +From: Kurt Van Dijck <[email protected]> +Date: Wed, 3 Jan 2018 20:38:15 +0100 +Subject: [PATCH] libmount, libblkid: fix order of autoconf probing + +make sure that libuuid is linked during probes. +Since libmount depends on libblkid, probe libblkid first. +This fixes autoprobing on systems that use static libraries exclusively + +Signed-off-by: Kurt Van Dijck <[email protected]> +--- + configure.ac | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 6fa8c41..50250d9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -103,9 +103,20 @@ AC_CHECK_HEADERS([ctype.h err.h fcntl.h grp.h libintl.h limits.h \ + time.h unistd.h]) + + # Check for conditional libraries and headers. ++if test "${with_blkid}" = "yes"; then ++ AC_CHECK_LIB(blkid, blkid_new_probe_from_filename, ++ [AC_DEFINE(HAVE_LIBBLKID, 1, ++ [Define to 1 if you have the 'blkid' library (-lblkid).]) ++ LIB_BLKID="-lblkid -luuid" ++ ], ++ AC_MSG_ERROR([BLKID library not found]), [-luuid]) ++ AC_CHECK_HEADERS([blkid/blkid.h]) ++fi ++AC_SUBST(LIB_BLKID) ++ + if test "${with_libmount}" = "yes"; then +- AC_CHECK_LIB(mount, mnt_context_do_mount, [LIB_MOUNT="-lmount"], +- AC_MSG_ERROR([Mount library is enabled but libmount not found])) ++ AC_CHECK_LIB(mount, mnt_context_do_mount, [LIB_MOUNT="-lmount $LIB_BLKID"], ++ AC_MSG_ERROR([Mount library is enabled but libmount not found]), [$LIB_BLKID]) + AC_CHECK_HEADERS([libmount/libmount.h]) + with_selinux=no + fi +@@ -124,17 +135,6 @@ if test "${with_selinux}" = "yes"; then + fi + AC_SUBST([LIB_SELINUX]) + +-if test "${with_blkid}" = "yes"; then +- AC_CHECK_LIB(blkid, blkid_new_probe_from_filename, +- [AC_DEFINE(HAVE_LIBBLKID, 1, +- [Define to 1 if you have the 'blkid' library (-lblkid).]) +- LIB_BLKID="-lblkid" +- ], +- AC_MSG_ERROR([BLKID library not found])) +- AC_CHECK_HEADERS([blkid/blkid.h]) +-fi +-AC_SUBST(LIB_BLKID) +- + # Checks for typedefs, structures, and compiler characteristics. + AC_C_CONST + AC_C_INLINE +-- +1.8.5.rc3 +
Signature · 1 line
1.8.5.rc3
PATCH 1/1 nilfs-utils: fix build with static toolchains
Hello,
Quoted 37 lines · Kurt Van Dijck
This commit adds a patch to respect the dependency
libmount->libblkid->libuuidproperly in autoconf. This becomes necessary for static builds.Signed-off-by Kurt Van Dijck <[email protected]>--- ...nt-libblkid-fix-order-of-autoconf-probing.patch | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patchpackage/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch new file +22
-0@@ -0,0 +1,62 @@ +From 94732d03c5361a9f8f9d0f018e0fd9850a2c7d29 Mon Sep 17 00:00:00 2001 +From: Kurt Van Dijck <[email protected]> +Date: Wed, 3 Jan 2018 20:38:15 +0100 +Subject: [PATCH] libmount, libblkid: fix order of autoconf probing + +make sure that libuuid is linked during probes. +Since libmount depends on libblkid, probe libblkid first. +This fixes autoprobing on systems that use static libraries exclusively + +Signed-off-by: Kurt Van Dijck <[email protected]> +--- + configure.ac | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 6fa8c41..50250d9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -103,9 +103,20 @@ AC_CHECK_HEADERS([ctype.h err.h fcntl.h grp.h libintl.h limits.h \ + time.h unistd.h]) + + # Check for conditional libraries and headers.
package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch line 32
Quoted 10 lines
package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch new file +10
-0++if test "${with_blkid}" = "yes"; then ++ AC_CHECK_LIB(blkid, blkid_new_probe_from_filename, ++ [AC_DEFINE(HAVE_LIBBLKID, 1, ++ [Define to 1 if you have the 'blkid' library (-lblkid).]) ++ LIB_BLKID="-lblkid -luuid" ++ ], ++ AC_MSG_ERROR([BLKID library not found]), [-luuid]) ++ AC_CHECK_HEADERS([blkid/blkid.h]) ++fi ++AC_SUBST(LIB_BLKID)
Thanks for this patch. Unfortunately, this really isn't the most appropriate solution. The good solution for this is to use pkg-config, through the PKG_CHECK_MODULES() autoconf macro.
if test "${with_blkid}" = "yes"; then
PKG_CHECK_MODULES([BLKID], [blkid])
fi
and then use BLKID_LIBS in Makefile.am to link against libblkid. pkg-config automatically takes care of indirect dependencies when static linking:
$ ./output/host/bin/pkg-config --libs blkid -L./output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lblkid -L./output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -luuid
Could you rework your patch accordingly ?
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 nilfs-utils: fix build with static toolchains
Quoted 60 lines
Hello,
Quoted 37 lines · Kurt Van Dijck
This commit adds a patch to respect the dependency
libmount->libblkid->libuuidproperly in autoconf. This becomes necessary for static builds.Signed-off-by Kurt Van Dijck <[email protected]>--- ...nt-libblkid-fix-order-of-autoconf-probing.patch | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patchpackage/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch new file +22
-0@@ -0,0 +1,62 @@ +From 94732d03c5361a9f8f9d0f018e0fd9850a2c7d29 Mon Sep 17 00:00:00 2001 +From: Kurt Van Dijck <[email protected]> +Date: Wed, 3 Jan 2018 20:38:15 +0100 +Subject: [PATCH] libmount, libblkid: fix order of autoconf probing + +make sure that libuuid is linked during probes. +Since libmount depends on libblkid, probe libblkid first. +This fixes autoprobing on systems that use static libraries exclusively + +Signed-off-by: Kurt Van Dijck <[email protected]> +--- + configure.ac | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 6fa8c41..50250d9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -103,9 +103,20 @@ AC_CHECK_HEADERS([ctype.h err.h fcntl.h grp.h libintl.h limits.h \ + time.h unistd.h]) + + # Check for conditional libraries and headers.package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch line 32
Quoted 10 lines
package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch new file +10
-0++if test "${with_blkid}" = "yes"; then ++ AC_CHECK_LIB(blkid, blkid_new_probe_from_filename, ++ [AC_DEFINE(HAVE_LIBBLKID, 1, ++ [Define to 1 if you have the 'blkid' library (-lblkid).]) ++ LIB_BLKID="-lblkid -luuid" ++ ], ++ AC_MSG_ERROR([BLKID library not found]), [-luuid]) ++ AC_CHECK_HEADERS([blkid/blkid.h]) ++fi ++AC_SUBST(LIB_BLKID)Thanks for this patch. Unfortunately, this really isn't the most appropriate solution. The good solution for this is to use pkg-config, through the
PKG_CHECK_MODULES()autoconf macro.if test "${with_blkid}" = "yes"; then
PKG_CHECK_MODULES([BLKID], [blkid])fi
Quoted 8 lines
and then use
BLKID_LIBSin Makefile.am to link against libblkid. pkg-config automatically takes care of indirect dependencies when static linking:$ ./output/host/bin/pkg-config --libs blkid -L./output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lblkid -L./output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -luuidCould you rework your patch accordingly ?
Ok, I'll rework.
Thanks for the feedback.
Kurt