GCC 4.6.1: ld cannot find shared libraries when in sysroot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to build some software in a 32-bit sysroot that shares the same directory organization as my 64-bit system. In my project, I build a dynamic library that links to other dynamic libraries as follows:

g++ -o libmylibrary.so -Wl,-Bdynamic -shared --sysroot=/sysroot {bunch of objects} -m32 -lsomeotherlibrary

I then attempt to build an application that links to my static library as follows:

g++ -o myprog --sysroot=/sysroot {bunch of objects} -m32 -lmylibrary

However, this time I get a bunch of errors like this:

/usr/bin/ld: warning: libsomeotherlibrary.so needed by libmylibrary.so, not found (try using -rpath or -rpath-link)
[bunch of errors about undefined references to someotherlibrary]

Adding -Wl,-rpath-link=/sysroot/usr/lib causes myprog to successfully link. This behavior confuses me because it seems to me that ld should be able to find libsomeotherlibrary.so in /sysroot/usr/lib/ just like it did when I built libmylibrary.so. Can someone explain this to me and describe how I can change my build process to avoid this?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux