Referencing sysroot libraries during build?

Wolfgang Denk <wd@...>


I have a build problem which is caused by libraries not being found.

It's a recipe to build the U-Boot bot loader which includes running
the "mkimage" tool generated during this build. This fails as

| LD u-boot
| OBJCOPY u-boot.bin
| MKIMAGE u-boot.img
error while loading shared libraries: cannot open shared object file: No such file or directory
| make: *** [u-boot.img] Error 127

I verified that the LD_LIBRARY_PATH variable is not set when these
commands are run, which explains the problem:

-> ldd /opt/eldk/build/eldk-rel-v5.6-2014-08-17-fe344de-mcvevk/tmp/work/mcvevk-linux-gnueabi/u-boot/v2014.10+gitAUTOINC+c43fd23cf6-r0/git/tools/mkimage => (0x00007fff6a7fe000) => not found => not found => /lib64/ (0x0000003396000000)
/lib64/ (0x0000003395c00000)

The reason is that this system uses a different version of these libraries:

-> ls -l /lib64/* /lib64/*
-rwxr-xr-x 1 root root 1972736 Aug 8 13:48 /lib64/
lrwxrwxrwx 1 root root 19 Sep 2 23:49 /lib64/ ->
-rwxr-xr-x 1 root root 446040 Aug 8 13:48 /lib64/
lrwxrwxrwx 1 root root 16 Sep 2 23:49 /lib64/ ->

So the host system is using one version of these libraries, while the
build is done against a different version.

I can work around this problem by adding the build's sysroot
libraries to LD_LIBRARY_PATH, like that:

do_compile_prepend () {

But this looks wrong to me - if this was needed, should it not be
done on a much higer level, at some central point so that all tools
run during the build will automatically pick up the matching
libraries from sysroot?

Or is this some problem anywhere else in my own code?

Thanks in advance.

Best regards,

Wolfgang Denk

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@...
If I had to live my life again, I'd make the same mistakes, only
sooner. -- Tallulah Bankhead

Join { to automatically receive all group messages.