All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
@ 2018-01-07 20:39 Kurt Van Dijck
  2018-01-07 22:29 ` Thomas Petazzoni
  2018-01-18 13:33 ` Thomas Petazzoni
  0 siblings, 2 replies; 10+ messages in thread
From: Kurt Van Dijck @ 2018-01-07 20:39 UTC (permalink / raw)
  To: buildroot

This commit adds a patch to respect the dependency libmount->libblkid->libuuid
properly in autoconf. This becomes necessary for static builds.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
---
 ...e-PKG_CHECK_MODULES-for-libmount-and-libb.patch | 140 +++++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 package/nilfs-utils/0004-autoconf-use-PKG_CHECK_MODULES-for-libmount-and-libb.patch

diff --git a/package/nilfs-utils/0004-autoconf-use-PKG_CHECK_MODULES-for-libmount-and-libb.patch b/package/nilfs-utils/0004-autoconf-use-PKG_CHECK_MODULES-for-libmount-and-libb.patch
new file mode 100644
index 0000000..c2e0d55
--- /dev/null
+++ b/package/nilfs-utils/0004-autoconf-use-PKG_CHECK_MODULES-for-libmount-and-libb.patch
@@ -0,0 +1,140 @@
+From 9cabaa6059e7bffcdeb6aa400fb6bb8bd2863aed Mon Sep 17 00:00:00 2001
+From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
+Date: Thu, 4 Jan 2018 09:47:45 +0100
+Subject: [PATCH] autoconf: use PKG_CHECK_MODULES for libmount and libblkid
+
+The dependencies of libmount to libblkid and libblkid to libuuid
+were not handled correctly, and only work for the shared object scenario.
+This commit switches the autoconfiguration to use PKG_CHECK_MODULES
+which handles the static vs. dynamic case.
+This commit has been compile-tested using buildroot on different compilers,
+including static & dynamic ones
+
+Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
+---
+ configure.ac                 | 13 +++----------
+ sbin/mkfs/Makefile.am        |  4 ++--
+ sbin/mkfs/mkfs.c             |  6 +++---
+ sbin/mount/Makefile.am       |  4 ++--
+ sbin/mount/mount_libmount.c  |  4 +---
+ sbin/mount/umount_libmount.c |  2 --
+ 6 files changed, 11 insertions(+), 22 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 6fa8c41..3e31e55 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -104,13 +104,10 @@ AC_CHECK_HEADERS([ctype.h err.h fcntl.h grp.h libintl.h limits.h \
+ 
+ # Check for conditional libraries and headers.
+ 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_HEADERS([libmount/libmount.h])
++   PKG_CHECK_MODULES([MOUNT], [mount])
+    with_selinux=no
+ fi
+ AM_CONDITIONAL(CONFIG_LIBMOUNT, [test "$with_libmount" = "yes"])
+-AC_SUBST(LIB_MOUNT)
+ 
+ if test "${with_selinux}" = "yes"; then
+    AC_CHECK_LIB(selinux, getprevcon,
+@@ -125,15 +122,11 @@ fi
+ AC_SUBST([LIB_SELINUX])
+ 
+ if test "${with_blkid}" = "yes"; then
+-   AC_CHECK_LIB(blkid, blkid_new_probe_from_filename,
++   PKG_CHECK_MODULES([BLKID], [blkid],
+    		[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
+diff --git a/sbin/mkfs/Makefile.am b/sbin/mkfs/Makefile.am
+index 28f5128..408c976 100644
+--- a/sbin/mkfs/Makefile.am
++++ b/sbin/mkfs/Makefile.am
+@@ -1,8 +1,8 @@
+ ## Makefile.am
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall $(BLKID_CFLAGS)
+ AM_CPPFLAGS = -I$(top_srcdir)/include
+-LDADD = -luuid $(LIB_BLKID) $(top_builddir)/lib/libnilfsfeature.la \
++LDADD = -luuid $(BLKID_LIBS) $(top_builddir)/lib/libnilfsfeature.la \
+ 	$(top_builddir)/lib/libmountchk.la \
+ 	$(top_builddir)/lib/libcrc32.la
+ 
+diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
+index d7f161e..0c45d6a 100644
+--- a/sbin/mkfs/mkfs.c
++++ b/sbin/mkfs/mkfs.c
+@@ -66,9 +66,9 @@
+ 
+ #include <errno.h>
+ 
+-#if HAVE_BLKID_BLKID_H
+-#include <blkid/blkid.h>
+-#endif	/* HAVE_BLKID_BLKID_H */
++#if HAVE_LIBBLKID
++#include <blkid.h>
++#endif	/* HAVE_LIBBLKID */
+ 
+ #include "nilfs.h"
+ #include "util.h"
+diff --git a/sbin/mount/Makefile.am b/sbin/mount/Makefile.am
+index f5d3c27..9554aa5 100644
+--- a/sbin/mount/Makefile.am
++++ b/sbin/mount/Makefile.am
+@@ -6,10 +6,10 @@ COMMONHEADERS = mount.nilfs2.h sundries.h xmalloc.h
+ LEGACYSOURCES = fstab.c mount_mntent.c mount_opts.c
+ LEGACYHEADERS = fstab.h mount_constants.h mount_mntent.h mount_opts.h
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall $(MOUNT_CFLAGS)
+ AM_CPPFLAGS = -I$(top_srcdir)/include
+ LDADD = $(top_builddir)/lib/librealpath.la \
+-	$(top_builddir)/lib/libcleanerexec.la $(LIB_MOUNT) $(LIB_SELINUX) \
++	$(top_builddir)/lib/libcleanerexec.la $(MOUNT_LIBS) $(LIB_SELINUX) \
+ 	$(LIB_POSIX_TIMER)
+ 
+ root_sbin_PROGRAMS = mount.nilfs2 umount.nilfs2
+diff --git a/sbin/mount/mount_libmount.c b/sbin/mount/mount_libmount.c
+index ef40e68..a7fec00 100644
+--- a/sbin/mount/mount_libmount.c
++++ b/sbin/mount/mount_libmount.c
+@@ -67,9 +67,7 @@
+ #include <syslog.h>
+ #endif	/* HAVE_SYSLOG_H */
+ 
+-#if HAVE_LIBMOUNT_LIBMOUNT_H
+-#include <libmount/libmount.h>
+-#endif	/* HAVE_LIBMOUNT_H */
++#include <libmount.h>
+ 
+ #include <stdarg.h>
+ #include <errno.h>
+diff --git a/sbin/mount/umount_libmount.c b/sbin/mount/umount_libmount.c
+index ae5a337..2987f5d 100644
+--- a/sbin/mount/umount_libmount.c
++++ b/sbin/mount/umount_libmount.c
+@@ -59,9 +59,7 @@
+ #include <syslog.h>
+ #endif	/* HAVE_SYSLOG_H */
+ 
+-#if HAVE_LIBMOUNT_LIBMOUNT_H
+ #include <libmount/libmount.h>
+-#endif	/* HAVE_LIBMOUNT_H */
+ 
+ #include <stdarg.h>
+ #include <errno.h>
+-- 
+1.8.5.rc3
+
-- 
1.8.5.rc3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-07 20:39 [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains Kurt Van Dijck
@ 2018-01-07 22:29 ` Thomas Petazzoni
  2018-01-07 22:42   ` Thomas Petazzoni
  2018-01-18 13:33 ` Thomas Petazzoni
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-07 22:29 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun,  7 Jan 2018 21:39:33 +0100, Kurt Van Dijck wrote:
> This commit adds a patch to respect the dependency libmount->libblkid->libuuid
> properly in autoconf. This becomes necessary for static builds.
> 
> Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>

Nit: when sending a new version of a patch, it is strongly recommended
to use [PATCH v2], [PATCH v3], and include a changelog...

> ---

... right here.


> +-#if HAVE_LIBMOUNT_LIBMOUNT_H
> +-#include <libmount/libmount.h>
> +-#endif	/* HAVE_LIBMOUNT_H */
> ++#include <libmount.h>
> + 
> + #include <stdarg.h>
> + #include <errno.h>
> +diff --git a/sbin/mount/umount_libmount.c b/sbin/mount/umount_libmount.c
> +index ae5a337..2987f5d 100644
> +--- a/sbin/mount/umount_libmount.c
> ++++ b/sbin/mount/umount_libmount.c
> +@@ -59,9 +59,7 @@
> + #include <syslog.h>
> + #endif	/* HAVE_SYSLOG_H */
> + 
> +-#if HAVE_LIBMOUNT_LIBMOUNT_H
> + #include <libmount/libmount.h>
> +-#endif	/* HAVE_LIBMOUNT_H */

You still haven't fixed the <libmount/libmount.h> vs. <libmount.h>
discrepancy here :-)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-07 22:29 ` Thomas Petazzoni
@ 2018-01-07 22:42   ` Thomas Petazzoni
  2018-01-08  8:35     ` Kurt Van Dijck
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-07 22:42 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 7 Jan 2018 23:29:00 +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Sun,  7 Jan 2018 21:39:33 +0100, Kurt Van Dijck wrote:
> > This commit adds a patch to respect the dependency libmount->libblkid->libuuid
> > properly in autoconf. This becomes necessary for static builds.
> > 
> > Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>  
> 
> Nit: when sending a new version of a patch, it is strongly recommended
> to use [PATCH v2], [PATCH v3], and include a changelog...

Also, when you're fixing autobuilder failures, your commit log should
include a reference to one such failure. Something like this:

Fixes:

  http://autobuild.buildroot.org/results/<hash>/

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-07 22:42   ` Thomas Petazzoni
@ 2018-01-08  8:35     ` Kurt Van Dijck
  2018-01-08  8:57       ` Thomas Petazzoni
  0 siblings, 1 reply; 10+ messages in thread
From: Kurt Van Dijck @ 2018-01-08  8:35 UTC (permalink / raw)
  To: buildroot

> > 
> > Nit: when sending a new version of a patch, it is strongly recommended
> > to use [PATCH v2], [PATCH v3], and include a changelog...
> 
> Also, when you're fixing autobuilder failures, your commit log should
> include a reference to one such failure. Something like this:
> 
> Fixes:
> 
>   http://autobuild.buildroot.org/results/<hash>/
> 
> Thanks!

I see. Will I resend?
Kurt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-08  8:35     ` Kurt Van Dijck
@ 2018-01-08  8:57       ` Thomas Petazzoni
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-08  8:57 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 8 Jan 2018 09:35:33 +0100, Kurt Van Dijck wrote:
> > > 
> > > Nit: when sending a new version of a patch, it is strongly recommended
> > > to use [PATCH v2], [PATCH v3], and include a changelog...  
> > 
> > Also, when you're fixing autobuilder failures, your commit log should
> > include a reference to one such failure. Something like this:
> > 
> > Fixes:
> > 
> >   http://autobuild.buildroot.org/results/<hash>/
> > 
> > Thanks!  
> 
> I see. Will I resend?

Well, I made other comments in a different e-mail, which indeed require
a resend.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-07 20:39 [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains Kurt Van Dijck
  2018-01-07 22:29 ` Thomas Petazzoni
@ 2018-01-18 13:33 ` Thomas Petazzoni
  2018-01-18 19:54   ` Kurt Van Dijck
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-18 13:33 UTC (permalink / raw)
  To: buildroot

Hello Kurt,

On Sun,  7 Jan 2018 21:39:33 +0100, Kurt Van Dijck wrote:
> This commit adds a patch to respect the dependency libmount->libblkid->libuuid
> properly in autoconf. This becomes necessary for static builds.
> 
> Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>

This problem is still occurring in the autobuilders. Could you send a
new version of this patch? The issues to be fixed were really minor.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-18 13:33 ` Thomas Petazzoni
@ 2018-01-18 19:54   ` Kurt Van Dijck
  0 siblings, 0 replies; 10+ messages in thread
From: Kurt Van Dijck @ 2018-01-18 19:54 UTC (permalink / raw)
  To: buildroot

Hey Thomas,

No worries, I didn't forget, but work and sick children came in between :-(
You may expect a new patch one of these days.

Kurt

--- Original message ---
> Date: Thu, 18 Jan 2018 14:33:07 +0100
> From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> To: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> Cc: buildroot at busybox.net
> Subject: Re: [Buildroot] [PATCH] nilfs-utils: fix build with static
>  toolchains
> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-redhat-linux-gnu)
> 
> Hello Kurt,
> 
> On Sun,  7 Jan 2018 21:39:33 +0100, Kurt Van Dijck wrote:
> > This commit adds a patch to respect the dependency libmount->libblkid->libuuid
> > properly in autoconf. This becomes necessary for static builds.
> > 
> > Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> 
> This problem is still occurring in the autobuilders. Could you send a
> new version of this patch? The issues to be fixed were really minor.
> 
> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-03 20:33 ` Thomas Petazzoni
@ 2018-01-04  8:14   ` Kurt Van Dijck
  0 siblings, 0 replies; 10+ messages in thread
From: Kurt Van Dijck @ 2018-01-04  8:14 UTC (permalink / raw)
  To: buildroot


> Hello,
> 
> On Wed,  3 Jan 2018 21:15:44 +0100, Kurt Van Dijck wrote:
> > This commit adds a patch to respect the dependency libmount->libblkid->libuuid
> > properly in autoconf. This becomes necessary for static builds.
> > 
> > Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> > ---
> >  ...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
> > 
> > diff --git a/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch b/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
> > new file mode 100644
> > index 0000000..78b6902
> > --- /dev/null
> > +++ b/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
> > @@ -0,0 +1,62 @@
> > +From 94732d03c5361a9f8f9d0f018e0fd9850a2c7d29 Mon Sep 17 00:00:00 2001
> > +From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> > +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 <dev.kurt@vandijck-laurijssen.be>
> > +---
> > + 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)
> 
> 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 ?

Ok, I'll rework.
Thanks for the feedback.

Kurt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
  2018-01-03 20:15 Kurt Van Dijck
@ 2018-01-03 20:33 ` Thomas Petazzoni
  2018-01-04  8:14   ` Kurt Van Dijck
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2018-01-03 20:33 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  3 Jan 2018 21:15:44 +0100, Kurt Van Dijck wrote:
> This commit adds a patch to respect the dependency libmount->libblkid->libuuid
> properly in autoconf. This becomes necessary for static builds.
> 
> Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> ---
>  ...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
> 
> diff --git a/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch b/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
> new file mode 100644
> index 0000000..78b6902
> --- /dev/null
> +++ b/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
> @@ -0,0 +1,62 @@
> +From 94732d03c5361a9f8f9d0f018e0fd9850a2c7d29 Mon Sep 17 00:00:00 2001
> +From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> +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 <dev.kurt@vandijck-laurijssen.be>
> +---
> + 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)

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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
@ 2018-01-03 20:15 Kurt Van Dijck
  2018-01-03 20:33 ` Thomas Petazzoni
  0 siblings, 1 reply; 10+ messages in thread
From: Kurt Van Dijck @ 2018-01-03 20:15 UTC (permalink / raw)
  To: buildroot

This commit adds a patch to respect the dependency libmount->libblkid->libuuid
properly in autoconf. This becomes necessary for static builds.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
---
 ...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

diff --git a/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch b/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
new file mode 100644
index 0000000..78b6902
--- /dev/null
+++ b/package/nilfs-utils/0004-libmount-libblkid-fix-order-of-autoconf-probing.patch
@@ -0,0 +1,62 @@
+From 94732d03c5361a9f8f9d0f018e0fd9850a2c7d29 Mon Sep 17 00:00:00 2001
+From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
+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 <dev.kurt@vandijck-laurijssen.be>
+---
+ 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
+
-- 
1.8.5.rc3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-01-18 19:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-07 20:39 [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains Kurt Van Dijck
2018-01-07 22:29 ` Thomas Petazzoni
2018-01-07 22:42   ` Thomas Petazzoni
2018-01-08  8:35     ` Kurt Van Dijck
2018-01-08  8:57       ` Thomas Petazzoni
2018-01-18 13:33 ` Thomas Petazzoni
2018-01-18 19:54   ` Kurt Van Dijck
  -- strict thread matches above, loose matches on Subject: below --
2018-01-03 20:15 Kurt Van Dijck
2018-01-03 20:33 ` Thomas Petazzoni
2018-01-04  8:14   ` Kurt Van Dijck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.