From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Alexey Brodkin via buildroot <buildroot@buildroot.org>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
Fabrice Fontaine <fontaine.fabrice@gmail.com>
Subject: Re: [Buildroot] [PATCH] package/numactl: point to target libs via LDFLAGS
Date: Mon, 24 Oct 2022 23:14:23 +0200 [thread overview]
Message-ID: <20221024231423.24f384e3@windsurf> (raw)
In-Reply-To: <20221024174911.75444-1-abrodkin@synopsys.com>
Hello Alexey,
On Mon, 24 Oct 2022 19:49:11 +0200
Alexey Brodkin via buildroot <buildroot@buildroot.org> wrote:
> In the commit a699a667bd64 ("package/numactl: add -latomic to numa.pc")
> we opted-out from unconditional linking with "-latomic" and made it
> a conditional based on real availability of __atomic_fetch_and_1()
> in the toolchain. I.e. for many targets "-latomic" was not used
> any longer.
>
> And in those supposedly rare cases when libatomic was required it was
> all OK until there's a LD_LIBRARY_PATH set with something where yet
> another libatomic.so instance exists, especially if that's the one from
> host (in my case I used a separately built host toolchain). Then we see:
> ---------------------->8-----------------------
> /bin/sh ./libtool --tag=CC --mode=link .../buildroot/output/host/bin/arc32-buildroot-linux-uclibc-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -Wl,-z,max-page-size=4096 -fPIC -std=gnu99 -o numastat numastat-numastat.o -latomic
>
> libtool: link: .../buildroot/output/host/bin/arc32-buildroot-linux-uclibc-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -Wl,-z -Wl,max-page-size=4096 -fPIC -std=gnu99 -o numastat numastat-numastat.o .../gcc-5.2.0/lib/../lib64/libatomic.so -pthread -Wl,-rpath -Wl,.../gcc-5.2.0/lib/../lib64 -Wl,-rpath -Wl,.../gcc-5.2.0/lib/../lib64
> .../buildroot/output/host/lib/gcc/arc32-buildroot-linux-uclibc/12.2.1/../../../../arc32-buildroot-linux-uclibc/bin/ld: .../gcc-5.2.0/lib/../lib64/libatomic.so: error adding symbols: file in wrong format
> collect2: error: ld returned 1 exit status
> ---------------------->8-----------------------
>
> That happens because libtool of numactl adds contents of the aforementioned
> LD_LIBRARY_PATH to its "$searchdirs" and then the first libatomic.so it
> finds becomes the one used for linking. What's more our precios cross-built
> libatomic.so never even gets considered because that first found libatomic.so
> is used with full path, not as "-latomic" as otherwise it would have been used
> without helpful libtool.
Thanks for the patch. However, I don't get it. Where is LD_LIBRARY_PATH
defined? Do you have a reproducer for this issue?
> +NUMACTL_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC" \
> + LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/lib"
This is really a red flag, $(STAGING_DIR)/lib is already in the default
search path of the compiler, so that should never be needed.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-10-24 21:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 17:49 [Buildroot] [PATCH] package/numactl: point to target libs via LDFLAGS Alexey Brodkin via buildroot
2022-10-24 21:14 ` Thomas Petazzoni via buildroot [this message]
2022-10-27 14:10 ` Alexey Brodkin via buildroot
2023-10-01 17:06 ` Thomas Petazzoni via buildroot
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=20221024231423.24f384e3@windsurf \
--to=buildroot@buildroot.org \
--cc=Alexey.Brodkin@synopsys.com \
--cc=fontaine.fabrice@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/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