Shared Libary Issue - cannot find library

Jonathan Wakely jwakely.gcc@gmail.com
Sun Feb 19 21:01:00 GMT 2012


On 19 February 2012 15:57, universaltoaster wrote:
>
> I'm having issues building and linking a library that I created to another
> executable.  Below are the steps that I followed.  NOTE:  I'm building this
> project on my computer (Ubuntu Karmic Koala) and then putting it on to an
> embedded arm device running busyBox linux.
>
> Here's the steps that I've gone through that lead me to a dreaded "cannot
> find MYLIB.so" when I try and run the application on the embedded device
>
> 1: arm-linux-gcc -Wall -fPIC -c MYLIB.c -O3 --sysroot home06
> 2: arm-linux-gcc -Wall -shared -Wl,-soname,libMYLIB.so.1 -o libMYLIB.so.1.0
> MYLIB.o -O3 --sysroot home06
> 3: ln -sf libMYLIB.so.1.0 libMYLIB.so //symbolic link for -lMYLIB
> 4: ln -sf libMYLIB.so.1.0 libMYLIB.so.1 //allows for runtime binding to work
> 5: arm-linux-gcc -lTXRX -lm -lMYLIB COMM.c -O3 --sysroot home06 -o RUNONBOX

How is this finding libMYLIB.so? I would expect it to need -L. or equivalent.

Is it finding a different libMYLIB.so in another directory?

> 6: ldd RUNONBOX
>>> not a dynamic executable //this doesn't seem good...no reference to
>>> MYLIB...  NOTE: I've built this program with -lTXRX and -lm many times
>>> before with ZERO issues
>
> 7: mput *.so* //put all symbolic links on device NOTE: folder is /tmp/cf
> 8: put RUNONBOX //put executable on device NOTE: folder is /tmp/cf
> 9: export LD_LIBRARY_PATH=/tmp/cf/:$LD_LIBRARY_PATH
> 9: ./RUNONBOX
>>> can't load library 'libMYLIB.so'

I don't know busybox but I would expect it to be looking for
libMYLIB.so.1 if it was linked against the library you built with that
soname.

> The questions that I have are
> A: Why won't my library be loaded even though I've set the LD_LIBRARY_PATH
> to look in the directory with libMYLIB.so?
> B: How do I have 2 other libraries that are linked to this program that do
> not show dependencies when I run 'ldd'?

Does ldd only support native executables, not the arm ones?



More information about the Gcc-help mailing list