I am trying to cross compile a simple hello world program for a linux system.
I have the following information:
uname -a
Linux (none) 2.6.32.28 #130 PREEMPT Mon Feb 18 13:54:18 CST 2013 armv5tejl GNU/Linux
cat /proc/cpuinfo
Processor : ARM926EJ-S rev 5 (v5l)
BogoMIPS : 421.06
Features : swp half fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant : 0x0
CPU part : 0x926
CPU revision : 5
Hardware : KeyASIC Ka2000 EVM
Revision : 0000
Serial : 0000000000000000
I would like to know how to cross compile for this system. I have tried the following:
- arm-linux-gnueabi-gcc helloworld.c -march=armv5 -o helloworld
- arm-linux-gnueabi-gcc helloworld.c -mcpu=arm926ej-s -o helloworld
But when I try and run the executable I get the error message "command not found". I am probably not compiling it correctly but I don't know what compile options to use given the information I have.
(I know the helloworld.c is all working).
ls -l helloworld
-rwxr-xr-x 1 0 0 8428 Jan 1 00:00 helloworld
which helloworld
which: applet not found
I put busybox-armv5l on
busybox which helloworld
(no output)
ldd is also not on the system I am trying to compile for (its the transcend WifiSD card).
ls -ln /lib/libc*
-rwxrwxrwx 1 0 0 244279 Jan 19 2012 /lib/libc.so.0
-rwxrwxrwx 1 0 0 13043 Jan 19 2012 /lib/libcrypt.so.0
-rwxr-xr-x 1 0 0 1251776 Jan 1 00:00 /lib/libcrypto.so.0.9.8
I tried to run /lib/libc.so.0 to get version information and I got a segmentation fault. It seems compiling with -static fixed the issue. So I guess it was an issue with the libc library. Thank you for the help.
ls -l /lib/libc*.so /lib/libc.*
. This shows the libc of the target. Yourgcc
version is glibc/eglibc. As well, the kernel may use OABI. You can use some options withld
to turn on debug, likeldd
.export LD_DEBUG=all
before attempting to run for example. – artless noise