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 1/1] libcap: depend on host-attr for the host
Date: Mon, 26 Oct 2015 09:58:27 +0100	[thread overview]
Message-ID: <20151026095827.2679c61f@free-electrons.com> (raw)
In-Reply-To: <1445722754-3477-2-git-send-email-mathstuf@gmail.com>

Dear Ben Boeckel,

On Sat, 24 Oct 2015 17:39:14 -0400, Ben Boeckel wrote:
> When a host-libcap is built, it is built without libattr support.
> However, libcap does not define some symbols based on this flag. This
> becomes a problem when a build-host tool is run (e.g., ls) which uses
> these symbols gets the host-libcap library via LD_LIBRARY_PATH.

Ok, so let me try to understand this a bit better. You say that if you
have host-libcap built and installed in $(HOST_DIR), then when you
build another package, if the build process of that package uses your
system 'ls' (i.e /bin/ls), then this ls doesn't work properly because
it uses $(HOST_DIR)/usr/lib/libacl.so instead of /usr/lib/libacl.so.

Is that correct ?

If that is correct, then I think your proposed change is not the right
solution, because it is just a workaround for the specific situation,
on your distribution, where ls gets linked against an acl that has attr
support. A similar problem can appear with other binaries/libraries,
and we don't want to clutter our host package dependencies to solve
such problems IMO.

Instead, I believe we should look at removing $(HOST_DIR)/usr/lib from
LD_LIBRARY_PATH, i.e do something like:

diff --git a/package/Makefile.in b/package/Makefile.in
index 8a592d4..10f3a47 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -298,12 +298,10 @@ HOST_CONFIGURE_OPTS = \
        PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
        PKG_CONFIG_SYSROOT_DIR="/" \
        PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig" \
-       LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))" \
        INTLTOOL_PERL=$(PERL)
 
 HOST_MAKE_ENV = \
        PATH=$(BR_PATH) \
-       LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))" \
        PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
        PKG_CONFIG_SYSROOT_DIR="/" \
        PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig"

We do build all host binaries in $(HOST_DIR) with a rpath that points
to $(HOST_DIR)/usr/lib, so this LD_LIBRARY_PATH should not be
necessary. And this LD_LIBRARY_PATH is indeed wrong as it means that
any system binary will first use the Buildroot-built host libraries
rather than the system ones, as you experienced. These LD_LIBRARY_PATH
were introduced back in February 2010, at a time when we were not
building host binaries with a rpath. So I believe they should by now be
unnecessary, and as you found out, potentially harmful.

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

  reply	other threads:[~2015-10-26  8:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24 21:39 [Buildroot] [PATCH 0/1] Build host-libcap with libattr support Ben Boeckel
2015-10-24 21:39 ` [Buildroot] [PATCH 1/1] libcap: depend on host-attr for the host Ben Boeckel
2015-10-26  8:58   ` Thomas Petazzoni [this message]
2015-10-26 14:27     ` Ben Boeckel
2015-10-27  6:29       ` Thomas Petazzoni
2015-10-29  2:49         ` Ben Boeckel
2015-10-29  2:48 ` [Buildroot] [PATCH] makefile: remove LD_LIBRARY_PATH from the environment Ben Boeckel
2015-11-13  1:37   ` Ben Boeckel
2015-11-13  6:37   ` Arnout Vandecappelle
2015-11-13  9:00     ` Yann E. MORIN
2015-11-13 22:19       ` Yann E. MORIN

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=20151026095827.2679c61f@free-electrons.com \
    --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