Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] binutils: replace hard-links with soft-links to fix rpath
Date: Mon, 23 Apr 2018 15:42:43 +0200	[thread overview]
Message-ID: <20180423134243.GA22035@scaer> (raw)
In-Reply-To: <20180423150412.145444ff@windsurf>

Thomas, All,

On 2018-04-23 15:04 +0200, Thomas Petazzoni spake thusly:
> On Mon, 23 Apr 2018 11:22:28 +0200, Yann E. MORIN wrote:
> > However, I wanted to reproduce the build failures, and here, with
> > current master, so I built a toolchain with buildroot [0], but none
> > of binutils programs is linked with libfl:
[--SNIP--]
> And indeed in the build process, I have:
> /bin/sh ./libtool --tag=CC   --mode=link /usr/bin/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I./../zlib -O2 -I/home/thomas/projets/buildroot/output/host/include  -L/home/thomas/projets/buildroot/output/host/lib -Wl,-rpath,/home/thomas/projets/buildroot/output/host/lib -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a -lfl  -ldl

And I too have a similar linking command, with your defconfig:

/bin/sh ./libtool --tag=CC   --mode=link /usr/bin/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I./../zlib -O2 -I/home/ymorin/dev/buildroot/O2/host/include  -static-libstdc++ -static-libgcc -L/home/ymorin/dev/buildroot/O2/host/lib -Wl,-rpath,/home/ymorin/dev/buildroot/O2/host/lib -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a -lfl  -ldl

which is turned into an actual link command:

libtool: link: /usr/bin/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I./../zlib -O2 -I/home/ymorin/dev/buildroot/O2/host/include -static-libstdc++ -static-libgcc -Wl,-rpath -Wl,/home/ymorin/dev/buildroot/O2/host/lib -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o -L/home/ymorin/dev/buildroot/O2/host/lib ../bfd/.libs/libbfd.a -L/home/ymorin/dev/buildroot/O2/build/host-binutils-arc-2018.03-rc1/zlib -lz ../libiberty/libiberty.a /home/ymorin/dev/buildroot/O2/host/lib/libfl.so -lm -ldl -Wl,-rpath -Wl,/home/ymorin/dev/buildroot/O2/host/lib -Wl,-rpath -Wl,/home/ymorin/dev/buildroot/O2/host/lib

So we can see that, yes, libfl.so *is* pulled in. Yet:

readelf -d host/arc-buildroot-linux-uclibc/bin/ar
Dynamic section at offset 0xd6a30 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/home/ymorin/dev/buildroot/O2/host/lib]
[--SNIP--]

So, WTF?

I'll be trying on another machine with an older system...

Regards,
Yann E. MORIN.

> To be honest, this is a bit weird, because for the other binutils,
> which we build from a tarball, host-flex is not needed, and we don't
> link against libfl.
> 
> See binutils/Makefile.am:
> 
> ar_LDADD = $(BFDLIB) $(LIBIBERTY) $(LEXLIB) $(LIBINTL)
> 
> and binutils/configure does check for the availability of a lex library. 
> 
> That being said, regardless of libfl specifically, I believe this
> problem of hard links between binaries in different directories really
> affects binutils anyway, and therefore, it makes sense to fix those to
> use symlinks instead.
> 
> Best regards,
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2018-04-23 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-22 12:23 [Buildroot] [PATCH] binutils: replace hard-links with soft-links to fix rpath Thomas Petazzoni
2018-04-23  9:22 ` Yann E. MORIN
2018-04-23 13:04   ` Thomas Petazzoni
2018-04-23 13:42     ` Yann E. MORIN [this message]
2018-05-06 20:18 ` Peter Korsgaard
2018-05-06 20:26   ` Thomas Petazzoni
2018-05-06 21:29     ` Yann E. MORIN
2018-05-24 21:05 ` Peter Korsgaard
2018-05-28 20:07   ` 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=20180423134243.GA22035@scaer \
    --to=yann.morin.1998@free.fr \
    --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