cross compile issue with simple hello program
Background : Trying to setup a cross compiler environment for arm target (TQ2440/Mini2440)
On HOST running Red Hat:
- Wrote a simple hello program
gcc -o hello hello.c- compiles successfully
./hello- displays the hello world message
rm helloarm-linux-gcc -o hello hello.cfile hello- It says
32bit compiled for ARM compatible for Linux 2.0.0
Transfer the "hello" binary file to TARGET
chmod a+x hello./helloThe problem:
/bin/sh: ./hello: not found
Can anyone point out my mistake or what am I missing here?
I executed ldd on host: ldd hello and I got:
/usr/local/arm/3.3.2/bin/ldd: line 1:
/usr/local/arm/3.3.2/lib/ld-linux.so.2: cannot execute binary file
/usr/local/arm/3.3.2/bin/ldd: line 1:
/usr/local/arm/3.3.2/lib/ld-linux.so.2: cannot execute binary file
ldd: /usr/local/arm/3.3.2/lib/ld开发者_运维知识库-linux.so.2 exited with unknown exit code (126)
Solved.
I was transfering the file through ftp. You need to enter bin to switch to binary transfer mode. Works fine now.
Try running ldd hello and see if it complains about any missing dynamic libraries.
加载中,请稍侯......
精彩评论