[Buildroot] Forcing linker to look at right library path?

C D dellicker at live.com
Tue Mar 14 18:43:29 UTC 2023


> From: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> Sent: Tuesday, March 14, 2023 12:58 AM
> To: C D
> Cc: buildroot at buildroot.org
> Subject: Re: [Buildroot] Forcing linker to look at right library path?
> 
> Hello,
> 
> On Mon, 13 Mar 2023 23:33:45 +0000
> C D <dellicker at live.com> wrote:
> 
> > 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.
> >
> > 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 Buildroot cross-compiler doesn't look for libraries in
> target/usr/lib, but in staging/usr/lib. Having shared libraries in
> target/usr/lib is important for your applications to work at run-time
> on the target, but those shared libraries should also be present in
> staging/usr/lib for the cross-compiler to find them at build time.

Thanks, this makes sense.  I've confirmed that the required libraries are
in both staging and target directories.
 
> > 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?
> 
> The answer entirely depends on which package you're trying to build.
> However, first thing would be to make sure that libasan and libubsan
> are both in staging/usr/lib. This should already help significantly, as
> it means the cross-compiler will find them.

I'm trying to build sedcli (https://github.com/sedcli/sedcli); the version
I'm building is a slightly modified private branch (added some debugging), but
the Makefile and configure script are basically identical.  I went through 
the Makefile and added $(DESTDIR) in appropriate locations to make the files
go where they need to, but after running a "make sedcli-reconfigure" I realized
the configure script isn't taking any off options Buildroot is using to attempt
to make it do the right thing, and I'm assuming this is where my problem is.
The output I get from it is:

Wrong option: --target=x86_64-buildroot-linux-gnu
Wrong option: --host=x86_64-buildroot-linux-gnu
Wrong option: --build=x86_64-pc-linux-gnu
Wrong option: --prefix=/usr
Wrong option: --exec-prefix=/usr
Wrong option: --sysconfdir=/etc
Wrong option: --localstatedir=/var
Wrong option: --program-prefix=
Wrong option: --disable-gtk-doc
Wrong option: --disable-gtk-doc-html
Wrong option: --disable-doc
Wrong option: --disable-docs
Wrong option: --disable-documentation
Wrong option: --with-xmlto=no
Wrong option: --with-fop=no
Wrong option: --disable-dependency-tracking
Wrong option: --enable-ipv6
Wrong option: --disable-nls
Wrong option: --disable-static
Wrong option: --enable-shared


> 
> Best regards,
> 
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbootlin.com%2F&data=05%7C01%7C%7C949137e634e94cd4b4dd08db2461e466%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638143775080541793%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zeXwvCO%2Fuj%2FGysbE7uhyVKJfrFA6dGa0cMe%2B5yQvh2I%3D&reserved=0

Thanks,
Chris


More information about the buildroot mailing list