Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/llvm: remove $ORIGIN/../lib from RPATH
Date: Wed, 11 Apr 2018 17:49:33 +0200	[thread overview]
Message-ID: <20180411174933.490f56ad@windsurf> (raw)
In-Reply-To: <20180411153022.13335-1-valentin.korenblit@smile.fr>

Hello Valentin,

On Wed, 11 Apr 2018 17:30:22 +0200, Valentin Korenblit wrote:
> AddLLVM.cmake adds $ORIGIN/../lib to the RPATH of llvm binaries.
> This causes a problem when llvm-config from host installed in
> STAGING_DIR is executed under the following conditions:
> 
> *Target architecture same as host architecture (normally x86_64)
> *Target's libc different from host's libc (normally glibc)
> 
> llvm-config will try to link with the target's libc, resulting in:
> 
> ./llvm-config: error while loading shared libraries: libc.so.0:
> cannot open shared object file: No such file or directory.
> 
> Link to autobuild error:
> http://autobuild.buildroot.net/results/b81c12d529c66a028e2297ea5ce1d6930324fa69/
> 
> To avoid this, remove the code from llvm_setup_rpath in AddLLVM.cmake
> 
> Link to discussion:
> http://lists.busybox.net/pipermail/buildroot/2018-April/218627.html
> 
> Signed-off-by: Valentin Korenblit <valentin.korenblit@smile.fr>

Thanks for this work. However, while this is going to work for the
Buildroot build (thanks to the hardcoded absolute RPATH encoded into
the binaries), I believe it will fail once "make sdk" is executed,
because "make sdk" will change the RPATH of binaries in STAGING_DIR to
be relative RPATHs.

Could you try after applying your patch:

$ make [.... do the normal build ...]
$ ./output/staging/usr/bin/llvm-config --the-flags-that-are-important
$ readelf -d output/staging/usr/bin/llvm-config
$ make sdk
$ ./output/staging/usr/bin/llvm-config --the-flags-that-are-important
$ readelf -d output/staging/usr/bin/llvm-config

Is there any difference before/after the "make sdk" ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-04-11 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 15:30 [Buildroot] [PATCH] package/llvm: remove $ORIGIN/../lib from RPATH Valentin Korenblit
2018-04-11 15:49 ` Thomas Petazzoni [this message]
2018-04-11 16:12   ` Valentin Korenblit
2018-04-11 16:48 ` Romain Naour

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=20180411174933.490f56ad@windsurf \
    --to=thomas.petazzoni@bootlin.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