c - cross compilation for ARM: error no such file or directory/command not found -
i have written simple hello world program , compiled gcc-arm-linux-gnueabi
compiler. compiles when try execute on arm machine complains "no such file or directory". think gcc-arm-linux-gnueabi
embedded linux due e(mbedded)abi. different arm linux abi?
please me solve problem
code here
#include "stdio.h" int main(void) { printf("hello world !\n"); return 0; }
compiled as
arm-linux-gnueabi-gcc -wall -o crosscomp hello.c
when execute crosscomp on target arm machine error crosscomp no such file or dir
edit when using arm-linux-gnueabi-gcc entry point not matching target machine entry point (readelf -l crosscom) when compiled aarch64-linux-gnu-gcc entry point matched target machine. error becomes permission denied on ./crosscomp. tried sudo says crosscomp: no such command.
note posted same question on askubuntu https://askubuntu.com/questions/904685/cross-compilation-for-arm-error-no-such-file-or-directory got no response.
the output of readelf below
elf header:
magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 class: elf64 data: 2's complement, little endian version: 1 (current) os/abi: unix - system v abi version: 0 type: exec (executable file) machine: aarch64 version: 0x1 entry point address: 0x400470 start of program headers: 64 (bytes file) start of section headers: 4488 (bytes file) flags: 0x0 size of header: 64 (bytes) size of program headers: 56 (bytes) number of program headers: 8 size of section headers: 64 (bytes) number of section headers: 29 section header string table index: 26
this peculiar error message happens when dynamic loader required particular executable missing.
you can find out name of dynamic loader need applying readelf
problem executable. on x86-64 linux box, example
$ readelf -l /bin/ls | grep 'program interpreter' [requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
("program interpreter" name "dynamic loader".)
so, run above command on crosscomp
binary on development box. (if don't have readelf
or error messages, try arm-linux-gnueabi-readelf
.) file named after "program interpreter:" needs exist on target arm machine. if don't know it, please post output of above command + ls -l
of directory should have missing file in it.
Comments
Post a Comment