Skip to contentSkip to conversation

Forcing linker to look at right library path?

Buildroot Andreas Ziegler 1 participant 1 message Mar 14, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Chris,

Quoted 4 lines · C D

Good afternoon,

I'm running in to an issue with a package linking against libubsan and libasan. I've figured out how to compile Buildroot so that it copies those libraries to the correct output/target/lib and output/target/lib64 locations, but it seems like the package is linking to the versions installed in my OS (RHEL 8.7) in /usr/lib64 instead.

Did you use BR2_TOOLCHAIN_EXTRA_LIBS? I would expect them to appear under /usr/lib[64] on the target.

Quoted 1 line

So, in /usr/lib64 I have libasan.so.5 and libubsan.so.1, and in Buildroot's output/target/lib64 I have libasan.so.6; when I boot into Buildroot and run my program, it errors out because it's looking for libasan.so.5.

The libraries and pkg-config files need to be present in the toolchain directory, usually located under output/host/<toolchain-name>/sysroot (normally ./usr/lib and ./usr/lib/pkg-config).

Quoted 1 line

What do I need to do for it to point to the correct library location when linking? Is this a Buildroot config option, or something I need to set up in my Makefile?

This is highly specific to (a) the build system used and (b) the interaction between Buildroot's and the package's make file.

Standard include paths for headers and libraries are preset in the toolchain binaries.

Buildroot sets the binary path, and standard environment variables before executing make in the package build directory.

If your Makefile uses variables that can be overridden, set them from the Buildroot package make file, using e.g. CONF_ENV (autotools) or MAKE_ENV (generic).

If the project Makefile uses pkg-config to determine include paths, you need a build-time dependency on host-pkgconf (and probably set PKG_CONFIG_PATH).

Quoted 3 lines

Thanks,
Chris

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot