I cross-compiled a small Hello World program for an embedded ARM device (Asus RT-AC68U router with DD-WRT):
The file looks fine:
# file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=5099693c31154cdd7f04c16ced5b80b1e35e625b, stripped
It depends on several libraries:
Dynamic section at offset 0xf08 contains 26 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
(...)
When I try to execute the file on the target system, I get the following:
-sh: ./hello: not found
If I run execution from ld-linux.so.3without any other parameters, everything works:
Hello, world.
When listing the libraries, the file seems to look for libraries in the / lib folder (they are not there, they are in / opt / lib):
libstdc++.so.6 => /lib/libstdc++.so.6 (0x76dfb000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x76de0000)
libc.so.6 => /opt/lib/libc.so.6 (0x76cb2000)
libc.so => /lib/libc.so (0x76c35000)
/lib/ld-linux.so.3 => /opt/lib/ld-linux.so.3 (0x76f20000)
I assume that the error is due to the fact that the executable file does not find the necessary shared libraries by itself. All necessary libraries are present in the / opt / lib folder, and this folder is included in the LD_LIBRARY_PATH environment variable:
/lib:/usr/lib:/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib
:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib
?
: , . , .