diff mbox

makefile: remove LD_LIBRARY_PATH from the environment

Message ID 1446086895-28252-1-git-send-email-mathstuf@gmail.com
State Superseded
Headers show

Commit Message

Ben Boeckel Oct. 29, 2015, 2:48 a.m. UTC
If system tools are selected, the host's lib/ directory may shadow
libraries from the system which are configured differently and do not
have all of the symbols required by the system tool.

Since buildroot uses rpath everywhere, LD_LIBRARY_PATH should not be
necessary anyways.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
 package/Makefile.in | 2 --
 1 file changed, 2 deletions(-)

Comments

Ben Boeckel Nov. 13, 2015, 1:37 a.m. UTC | #1
On Wed, Oct 28, 2015 at 22:48:15 -0400, Ben Boeckel wrote:
> If system tools are selected, the host's lib/ directory may shadow
> libraries from the system which are configured differently and do not
> have all of the symbols required by the system tool.
> 
> Since buildroot uses rpath everywhere, LD_LIBRARY_PATH should not be
> necessary anyways.
> 
> Signed-off-by: Ben Boeckel <mathstuf@gmail.com>

Bump.

--Ben
Arnout Vandecappelle Nov. 13, 2015, 6:37 a.m. UTC | #2
On 29-10-15 03:48, Ben Boeckel wrote:
> If system tools are selected, the host's lib/ directory may shadow
> libraries from the system which are configured differently and do not
> have all of the symbols required by the system tool.
> 
> Since buildroot uses rpath everywhere, LD_LIBRARY_PATH should not be
> necessary anyways.
> 
> Signed-off-by: Ben Boeckel <mathstuf@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 As I mentioned in a discussion with Yann (don't remember if it was on IRC or on
the list), I think we should apply this now no master to see what the
autobuilders say. We currently break the build on Fedora 23 for any
configuration including libattr, which IMHO is worse than the (probably small)
number of host-tools that are missing rpath.

 If we apply this patch _now_, we still have a few weeks to look at autobuild
results and handle the fallout.

 Note that all the host tools that are mentioned in Config.in.host will have to
be tested manually. Anybody up for that? Also the boot loaders will have to be
tested manually since they're not handled by the autobuilders.

 Regards,
 Arnout

> ---
>  package/Makefile.in | 2 --
>  1 file changed, 2 deletions(-)
> 
> 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"
>
Yann E. MORIN Nov. 13, 2015, 9 a.m. UTC | #3
On November 13, 2015 7:37:46 AM GMT+01:00, Arnout Vandecappelle <arnout@mind.be> wrote:
>On 29-10-15 03:48, Ben Boeckel wrote:
>> If system tools are selected, the host's lib/ directory may shadow
>> libraries from the system which are configured differently and do not
>> have all of the symbols required by the system tool.
>> 
>> Since buildroot uses rpath everywhere, LD_LIBRARY_PATH should not be
>> necessary anyways.
>> 
>> Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
>
>Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>
>As I mentioned in a discussion with Yann (don't remember if it was on
>IRC or on
>the list), I think we should apply this now no master to see what the
>autobuilders say. We currently break the build on Fedora 23 for any
>configuration including libattr, which IMHO is worse than the (probably
>small)
>number of host-tools that are missing rpath.
>
>If we apply this patch _now_, we still have a few weeks to look at
>autobuild
>results and handle the fallout.
>
>Note that all the host tools that are mentioned in Config.in.host will
>have to
>be tested manually. Anybody up for that? Also the boot loaders will
>have to be
>tested manually since they're not handled by the autobuilders.
>
> Regards,
> Arnout
>
>> ---
>>  package/Makefile.in | 2 --
>>  1 file changed, 2 deletions(-)
>> 
>> 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"
>> 
>
>
>-- 
>Arnout Vandecappelle                          arnout at mind be
>Senior Embedded Software Architect            +32-16-286500
>Essensium/Mind                                http://www.mind.be
>G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
>LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
>GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
>_______________________________________________
>buildroot mailing list
>buildroot@busybox.net
>http://lists.busybox.net/mailman/listinfo/buildroot

Ben, Arnout, All,

NAK for this one is the current state.

I have been working on it in the past few days (current branch not pushed, I'm away... Will push tonight):
http://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/no-ld-library-path

We still have packages that are missing the rpath, but that's not the only issue.

Look at libcurl: we're fiddling with LD_LIBRARY_PATH. Since we're setting it today, it is not empty. But if we no longer set it, we'd have the current directory in it (see the dependency check we do on it too for info).

So we should at least fix the known issues first, which I'm working on... More on this tonight when I land back home...

Regards,
Yann E. MORIN (on the move).
Yann E. MORIN Nov. 13, 2015, 10:19 p.m. UTC | #4
Ben, Arnout, Peter, All,

+Peter on this, because it is important he reads Arnout's comments and
my reply about it (for once, I agree with Arnout! ;-] ).

On 2015-11-13 10:00 +0100, Yann E. MORIN spake thusly:
> On November 13, 2015 7:37:46 AM GMT+01:00, Arnout Vandecappelle <arnout@mind.be> wrote:
>  On 29-10-15 03:48, Ben Boeckel wrote:
>   If system tools are selected, the host's lib/ directory may shadow
>   libraries from the system which are configured differently and do not
>   have all of the symbols required by the system tool.
>  
>   Since buildroot uses rpath everywhere, LD_LIBRARY_PATH should not be
>   necessary anyways.
>  
>   Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
> 
>  Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

I've marked your patch as superseded in Pathwork, since I have now
included it in my series:
    http://lists.busybox.net/pipermail/buildroot/2015-November/144362.html

Thanks! :-)

>   As I mentioned in a discussion with Yann (don't remember if it was on IRC or on
>  the list), I think we should apply this now no master to see what the
>  autobuilders say. We currently break the build on Fedora 23 for any
>  configuration including libattr, which IMHO is worse than the (probably small)
>  number of host-tools that are missing rpath.

And we should normally no longer have any host tool missing an RPATH.
I have built all of them now, and the one that was broken wrt. rpath,
I fixed.

>   If we apply this patch _now_, we still have a few weeks to look at autobuild
>  results and handle the fallout.

And at worst, we can simply revert it. Even if the patch touches a
critical aspect of the build system, it is very well contained, so will
be very easy to revert at the last minute if need be.

>   Note that all the host tools that are mentioned in Config.in.host will have to
>  be tested manually. Anybody up for that? Also the boot loaders will have to be
>  tested manually since they're not handled by the autobuilders.

Ah, I forgot about the bootloaders... ;-/

However, for the host tools, here's what I did;

    $ git grep -l -E '^\$\(eval \$\(host-'    \
    |sed 'magic-to-extract-pkg-name'        \
    >host-pkg-list

    $ vi host-pkg-list  # remove gcc, binutils, gdb

    $ make $(cat host-pkg-list)

And after ~73min, all the host packages in the lit have been built, and
none were installing executables missing an RPATH when they are using
our host libs.

Note: openssl install libraries that are missing an RPATH: libssl.so and
all the engines libraries. But that's in practice not an issue, since
the executables that uses those libraries do have an RPATH (as they were
able to find those libs in the first place!) so they will also find the
dependencies of those libs.

Regards,
Yann E. MORIN.
diff mbox

Patch

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"