0
votes

I cross compiled a program on Ubuntu 12.04 running on x86 using gcc-arm-linux-gnueabi and binutils-arm-linux-gnueabi and compiling with arm-linux-gnueabi-gcc instead of gcc with my target architecture being ARM. It compiles fine with no errors or warnings.

When I try to run it on the ARM machine (Pandaboard - also running Ubuntu 12.04) I get:

bash: ./sttyl: No such file or directory

I know the file is there and it has the proper permissions:

-rwxrwxr-x 1 haziz haziz 8.5K Feb 10 10:34 sttyl

The output of file sttyl is

sttyl: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31,BuildID[sha1]=0x6d504f7d84b93603122223a89e2b5960c840309f, not stripped

When I compile it natively on the Pandaboard it compiles and runs fine. This is the output of file sttyl on the natively compiled copy:

sttyl: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31,BuildID[sha1]=0x9897c785266c5b7cdf580e08091aba239db84ecf, not stripped

What am I doing wrong? Moreover if I had made a mistake in the cross compilation I would have expected the shell/kernel to tell me effectively that the executable is for the wrong architecture not that it does not exist!

1
You've probably got issues with the dynamic linker or C library. Try readelf -a your_program and look for "Requesting program interpreter".Mat

1 Answers

1
votes

It isn't telling you that ./sttyl doesn't exist.

It's telling you that it spawned a new process, which exited with error No such file or directory. No information is provided about which file or directory was missing.

For example, a shell script starting with #!/bin/specialsh could generate that error if the interpreter /bin/specialsh was missing, even though the script existed and was executable.

Try using strace to find out what call (and path) caused the error.