Reputation: 808
I am trying to implement a dynamic library(liblog.so
) which is going to run on i386 controller.
when i compile that in Host Machine (Ubuntu Machine)
it compiles and generates the .so
file successfully.
liblog.so
is the the file which is put under /usr/lib
in target machine.
merom@arunkumar:~/freedcs/freedcs-code1/Controller/src/Controller$ ldd log_client
linux-gate.so.1 => (0xb7707000)
libnative.so.3 => not found
libxenomai.so.0 => not found
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb76cd000)
librt.so.0 => not found
liblog.so => /usr/lib/liblog.so (0xb76c9000)
libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0xb751e000)
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0xb74c7000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb74a9000)
libc.so.0 => not found
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb72f5000)
/lib/ld-uClibc.so.0 => /lib/ld-linux.so.2 (0xb7708000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb72f0000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb72d7000)
merom@arunkumar:~/freedcs/freedcs-code1/Controller/src/Controller$
output at host machine.
Output at target machine:
libnative.so.3 => /usr/lib/libnative.so.3 (0xb78d9000)
libxenomai.so.0 => /usr/lib/libxenomai.so.0 (0xb78d4000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb78c1000)
librt.so.0 => /lib/librt.so.0 (0xb78bd000)
liblog.so => /lib/liblog.so (0xb78b9000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0xb7793000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0xb7752000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7748000)
libc.so.0 => /lib/libc.so.0 (0xb770a000)
libdl.so.0 => /lib/libdl.so.0 (0xb7706000)
libc.so.6 => not found
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb78e2000)
when i send it to Target machine(Currently in VMware), when i run the .\log_client
it shows can't load library 'libc.so.6'
Yes i compiled log_client
with linked with liblog.so
Compilation Commands
Generating liblog.so
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -c log.c -o liblog.o
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -shared -o liblog.so liblog.o -rdynamic -lcrypto -lssl
Generating log_client
cp liblog.so ../../../../build/i386/buildroot-2011.11/output/target/usr/lib
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -c log_client.c
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -o log_client log_client.o -llog -rdynamic -lcrypto -lssl
I am using same procedure for an other code that is working, though that code doesn't use this customized library(liblog.so
), there were warnings too but i didn't posted here.
Please help me, i am frustrated!!
------------Edited----------
file
Output
$ file liblog.so
liblog.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
$ file log_client
log_client: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
------------Update----------
Some one suggested me use --sysroot
while compiling the files, but even that didn't helped me. Same error coming out. :(
I had put sysroot
path to target machine's GCC's sysroot path
Generating liblog.so
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -c log.c -o liblog.o --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -shared -o liblog.so liblog.o -rdynamic -lcrypto -lssl --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
Generating log_client
cp liblog.so ../../../../build/i386/buildroot-2011.11/output/target/usr/lib
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -c log_client.c --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
../../../../build/i386/buildroot-2011.11/output/host/usr/bin/i686-unknown-linux-uclibc-gcc -Wcast-align -g -W -Wall -L../../../../build/i386/buildroot-2011.11/output/target/usr/lib -lxenomai -lpthread -lrt -o log_client log_client.o -llog -rdynamic -lcrypto -lssl --sysroot=/home/merom/freedcs/build/i386/buildroot-2011.11/output/host/usr/i686-unknown-linux-uclibc/sysroot/
Update
After Running objdump This was the output.
objdump -x log_client | grep NEEDED
NEEDED libnative.so.3
NEEDED libxenomai.so.0
NEEDED libpthread.so.0
NEEDED librt.so.0
NEEDED liblog.so
NEEDED libcrypto.so.1.0.0
NEEDED libssl.so.1.0.0
NEEDED libgcc_s.so.1
NEEDED libc.so.0
objdump -x liblog.so | grep NEEDED
NEEDED libnative.so.3
NEEDED libxenomai.so.0
NEEDED libpthread.so.0
NEEDED librt.so.0
NEEDED libcrypto.so.1.0.0
NEEDED libssl.so.1.0.0
NEEDED libgcc_s.so.1
NEEDED libc.so.0
Upvotes: 4
Views: 8006
Reputation: 710
I had the same problem with an executable. Every tool I tried - ldd, objdump, readelf, strings - indicated depencency with libc.so.0, rather than .6. It turned out that one of its dependent libraries was depending on .6. So I went and fixed that and everything is working now.
The library had the wrong version because it was compiled using the wrong cross-compiler (I used it by mistake), so I recompiled and reuploaded it.
Upvotes: 1