I'm trying a simple cross compile (cc) for an ARM-CORTEX-A9: To keep things simple thats the c-code:
#include <stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
The native compilation on the arm works fine and is started with gcc helloworld.c -o helloworld
whereas the cross compile is started with arm-xilinx-linux-gnueabi-gcc helloworld.c -o helloworld_cc
GCC Version:
nativ: gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) Target: arm-linux-gnueabihf
CC: gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-79) Target: arm-xilinx-linux-gnueabi
ABI from readelf:
readelf-nativ: OS: Linux, ABI: 2.6.31
readelf-cc: OS: Linux, ABI: 2.6.16
Linked libs - the cross compiled is statically linked so it shouldn't miss any libs:
root@localhost:/temp# ldd helloworld
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ed8000)
/lib/ld-linux-armhf.so.3 (0xb6fce000)
root@localhost:/temp# ldd helloworld_cc
not a dynamic executable
The Problem: the native program runs fine, the cc always ends up with:
root@localhost:/tmp# ./helloworld_cc
-bash: ./helloworld_cc: No such file or directory
Any hints, hopefully, I have included enough information.
edit
Linking it static does the trick, but now the size of the file is huge (678kB (CC-static) vs. 4kB(native)? Why is it missing libs even if it says it is not dynamically linked? Similar question: Cross compiling static C hello world for Android using arm-linux-gnueabi-gcc
arm-xilinx-linux-gnueabi-gcc helloworld.c -o helloworld_cc -static
Ther was a missing link in the
lib
folder Linaro Ubuntu. It showed up withreadelf -a
Putting the link
lib/ld-linux.so.3
tolib/arm-linux-gnueabihf/ld-2.15.so
and it works.
Thanks for the help Sergey