While trying to create a graphical Qt application for the Sitara AM335x development board using the TI supplied toolchain, the output binary, which has dynamic dependencies fails to execute.
root@am335x-evm:~# bin/Sitara_Template -qws
-sh: bin/Sitara_Template: not found
While troubleshooting, I have compiled a very simple (hello world!) program, the command I used is the following:
user@debian:~/Test$ source /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/environment-setup
[linux-devkit]:~/Test> arm-linux-gnueabihf-gcc -v -o test test.c
The collect (linker) was executed with the following options:
COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-march=armv7-a' '-mtune=cortex-a9' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mthumb' '-mtls-dialect=gnu'
/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../libexec/gcc/arm-linux-gnueabihf/4.7.3/collect2 --sysroot=/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc --build-id --eh-frame-hdr -dynamic-linker /lib/ld-linux-armhf.so.3 -X -m armelf_linux_eabi -o test /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/4.7.3/crt1.o /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/4.7.3/crti.o /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/crtbegin.o -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3 -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/lib -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf/4.7.3 -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/lib -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/4.7.3 -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/usr/lib -L/opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf /tmp/cc63DaPH.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/crtend.o /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/4.7.3/crtn.o
This generates the executable binary file "test", which I then copy over to the development board.
On the development board, through SSH I execute:
root@am335x-evm:~# readelf -d bin/test
Dynamic section at offset 0x454 contains 24 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x82a1
0x0000000d (FINI) 0x8429
0x00000019 (INIT_ARRAY) 0x10448
0x0000001b (INIT_ARRAYSZ) 4 (bytes)
0x0000001a (FINI_ARRAY) 0x1044c
0x0000001c (FINI_ARRAYSZ) 4 (bytes)
0x00000004 (HASH) 0x8194
0x00000005 (STRTAB) 0x820c
0x00000006 (SYMTAB) 0x81bc
0x0000000a (STRSZ) 65 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
0x00000003 (PLTGOT) 0x1053c
0x00000002 (PLTRELSZ) 32 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x8280
0x00000011 (REL) 0x8278
0x00000012 (RELSZ) 8 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x8258
0x6fffffff (VERNEEDNUM) 1
0x6ffffff0 (VERSYM) 0x824e
0x00000000 (NULL) 0x0
As comparison, this is the output for an executable that comes with the sistem image:
root@am335x-evm:~# readelf -d /bin/tinylogin
Dynamic section at offset 0x8460 contains 25 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libcrypt.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x9c6c
0x0000000d (FINI) 0xf13c
0x00000019 (INIT_ARRAY) 0x18454
0x0000001b (INIT_ARRAYSZ) 4 (bytes)
0x0000001a (FINI_ARRAY) 0x18458
0x0000001c (FINI_ARRAYSZ) 4 (bytes)
0x6ffffef5 (GNU_HASH) 0x8168
0x00000005 (STRTAB) 0x91f0
0x00000006 (SYMTAB) 0x88b0
0x0000000a (STRSZ) 1147 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
0x00000003 (PLTGOT) 0x18550
0x00000002 (PLTRELSZ) 1128 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x9804
0x00000011 (REL) 0x97d4
0x00000012 (RELSZ) 48 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x9794
0x6fffffff (VERNEEDNUM) 2
0x6ffffff0 (VERSYM) 0x966c
0x00000000 (NULL) 0x0
"tinylogin" executes correctly but "test" fails to execute:
root@am335x-evm:~# bin/test
-sh: bin/test: not found
Note: "test" executes correctly when compiled as a statically linked program:
[linux-devkit]:~/Test> arm-linux-gnueabihf-gcc -v -o test test.c --static
At this point I also tried compiling an example application with the supplied makefile from the SDK to see if it worked:
[linux-devkit]:~/Test> cd /opt/ti-sdk-am335x-evm-06.00.00.00/example-applications/am-sysinfo-git/mem_util/
[linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00/example-applications/am-sysinfo-git/mem_util> make -f makefile
But the output binary also fails to execute on the Development board:
root@am335x-evm:~# bin/mem_util
-sh: bin/mem_util: not found
I am unsure on how to fix this issue. Thank you in advance for your help.