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 2/2] microperl: install host-microperl in $(HOST_DIR)/opt/perl
Date: Wed, 28 Mar 2012 14:52:11 +0200	[thread overview]
Message-ID: <20120328145211.470f0fc3@skate> (raw)
In-Reply-To: <20120328125547.6873d986@skate>

Le Wed, 28 Mar 2012 12:55:47 +0200,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

> In the past, we had the problem that when we were building target
> packages that required host utilities installed in $(HOST_DIR)/usr/bin,
> those utilities were not able to find their libraries in
> $(HOST_DIR)/usr/lib. We tried using LD_LIBRARY_PATH, but libtool used
> it as the search path for libraries when compiling target stuff. So, we
> decided to hardcode the correct rpath in all binaries built and
> installed in $(HOST_DIR)/usr/bin.

I had a quick look at this, and here the Perl dynamic module that
depends on libexpat.so.1 is built with the correct RPATH:

$ arm-linux-gnueabi-readelf -a host/usr/lib/perl/auto/XML/Parser/Expat/Expat.so | grep RPATH
 0x000000000000000f (RPATH)              Library rpath: [/opt/outputs/perl/host/usr/lib]

So normally, when this Expat.so library is dlopen'ed by Perl, it should
use the RPATH of Expat.so to find where libexpat.so.1 is located. And
on my system, it does:

$ PERLLIB=/opt/outputs/perl/host/usr/lib/perl/ LD_DEBUG=libs perl -e 'require XML::Parser;'
      9529:	find library=libperl.so.5.10 [0]; searching
      9529:	 search cache=/etc/ld.so.cache
      9529:	  trying file=/usr/lib/libperl.so.5.10
      9529:	
      9529:	find library=libdl.so.2 [0]; searching
      9529:	 search cache=/etc/ld.so.cache
      9529:	  trying file=/lib/x86_64-linux-gnu/libdl.so.2
      9529:	
      9529:	find library=libm.so.6 [0]; searching
      9529:	 search cache=/etc/ld.so.cache
      9529:	  trying file=/lib/x86_64-linux-gnu/libm.so.6
      9529:	
      9529:	find library=libpthread.so.0 [0]; searching
      9529:	 search cache=/etc/ld.so.cache
      9529:	  trying file=/lib/x86_64-linux-gnu/libpthread.so.0
      9529:	
      9529:	find library=libc.so.6 [0]; searching
      9529:	 search cache=/etc/ld.so.cache
      9529:	  trying file=/lib/x86_64-linux-gnu/libc.so.6
      9529:	
      9529:	find library=libcrypt.so.1 [0]; searching
      9529:	 search cache=/etc/ld.so.cache
      9529:	  trying file=/lib/x86_64-linux-gnu/libcrypt.so.1
      9529:	
      9529:	
      9529:	calling init: /lib/x86_64-linux-gnu/libpthread.so.0
      9529:	calling init: /lib/x86_64-linux-gnu/libc.so.6
      9529:	calling init: /lib/x86_64-linux-gnu/libcrypt.so.1
      9529:	calling init: /lib/x86_64-linux-gnu/libm.so.6
      9529:	calling init: /lib/x86_64-linux-gnu/libdl.so.2
      9529:	calling init: /usr/lib/libperl.so.5.10
      9529:	
      9529:	
      9529:	initialize program: perl
      9529:	transferring control: perl
      9529:	
      9529:	find library=libexpat.so.1 [0]; searching
      9529:	 search path=/opt/outputs/perl/host/usr/lib/tls/x86_64:/opt/outputs/perl/host/usr/lib/tls:/opt/outputs/perl/host/usr/lib/x86_64:/opt/outputs/perl/host/usr/lib		(RPATH from file /opt/outputs/perl/host/usr/lib/perl//auto/XML/Parser/Expat/Expat.so)
      9529:	  trying file=/opt/outputs/perl/host/usr/lib/tls/x86_64/libexpat.so.1
      9529:	  trying file=/opt/outputs/perl/host/usr/lib/tls/libexpat.so.1
      9529:	  trying file=/opt/outputs/perl/host/usr/lib/x86_64/libexpat.so.1
      9529:	  trying file=/opt/outputs/perl/host/usr/lib/libexpat.so.1
      9529:	
      9529:	calling init: /opt/outputs/perl/host/usr/lib/libexpat.so.1
      9529:	calling init: /opt/outputs/perl/host/usr/lib/perl//auto/XML/Parser/Expat/Expat.so
      9529:	calling fini: perl [0]
      9529:	calling fini: /usr/lib/libperl.so.5.10 [0]
      9529:	calling fini: /lib/x86_64-linux-gnu/libdl.so.2 [0]
      9529:	calling fini: /lib/x86_64-linux-gnu/libm.so.6 [0]
      9529:	calling fini: /lib/x86_64-linux-gnu/libpthread.so.0 [0]
      9529:	calling fini: /lib/x86_64-linux-gnu/libcrypt.so.1 [0]
      9529:	calling fini: /opt/outputs/perl/host/usr/lib/perl//auto/XML/Parser/Expat/Expat.so [0]
      9529:	calling fini: /opt/outputs/perl/host/usr/lib/libexpat.so.1 [0]
      9529:	calling fini: /lib/x86_64-linux-gnu/libc.so.6 [0]

As you can see here, it clearly looks in the RPATH encoded into
Expat.so to find where libexpat.so.1 is located. In my
case /opt/outputs/perl/ in the Buildroot output directory, and it
clearly uses the libexpat.so.1 from this output directory, and not the
one from my system.

Are you sure you don't have any value set in your LD_LIBRARY_PATH
environment variable (outside of Buildroot)? Can you try the commands
above (check the RPATH of Expat.so and check the resolution of
libraries when asking Perl to require the XML::Parser module, when
PERLLIB points to the Perl modules built by Buildroot), and post the
results?

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  parent reply	other threads:[~2012-03-28 12:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27  7:06 [Buildroot] [pull request] Pull request for branch for-2012.05/perl Thomas Petazzoni
2012-03-27  7:06 ` [Buildroot] [PATCH 1/2] microperl: fix MICROPERL_INSTALL_TARGET_CMDS Thomas Petazzoni
2012-03-28  6:28   ` Peter Korsgaard
2012-03-27  7:06 ` [Buildroot] [PATCH 2/2] microperl: install host-microperl in $(HOST_DIR)/opt/perl Thomas Petazzoni
2012-03-27  7:12   ` Thomas Petazzoni
2012-03-28  6:54   ` Peter Korsgaard
2012-03-28  7:55     ` Thomas Petazzoni
2012-03-28  9:32       ` Peter Korsgaard
2012-03-28 10:40         ` Will Newton
2012-03-28 10:55           ` Thomas Petazzoni
2012-03-28 12:47             ` Will Newton
2012-03-28 12:52             ` Thomas Petazzoni [this message]
2012-03-28 13:01               ` Will Newton
2012-03-28 13:10                 ` Will Newton
2012-03-28 13:18                 ` Thomas Petazzoni
2012-03-28 14:00                   ` Will Newton
2012-03-28 15:46                     ` Thomas Petazzoni

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=20120328145211.470f0fc3@skate \
    --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