Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains
Date: Wed, 3 Jan 2018 21:33:59 +0100	[thread overview]
Message-ID: <20180103213359.10611a4e@windsurf.lan> (raw)
In-Reply-To: <1515010544-28357-1-git-send-email-dev.kurt@vandijck-laurijssen.be>

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

  reply	other threads:[~2018-01-03 20:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 20:15 [Buildroot] [PATCH] nilfs-utils: fix build with static toolchains Kurt Van Dijck
2018-01-03 20:33 ` Thomas Petazzoni [this message]
2018-01-04  8:14   ` Kurt Van Dijck
  -- strict thread matches above, loose matches on Subject: below --
2018-01-07 20:39 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180103213359.10611a4e@windsurf.lan \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox