Ich bin auf ein seltsamstes Problem gestoßen, das ich jemals getroffen habe. Ich kompiliere eine App für ARM CPU mit Linux on-board. Ich verwende buildroot, und alles geht gut, bis ich versuche, die Anwendung auf dem Ziel auszuführen: Ich bekomme -sh: ./hw: not found
. Z.B .:"sh: ./ <file> nicht gefunden" Fehler beim Versuch, eine Datei auszuführen
$ cat /tmp/test.cpp
#include <cstdio>
#include <vector>
int main(int argc, char** argv){
printf("Hello Kitty!\n");
return 0;
}
$ ./arm-linux-g++ -march=armv7-a /tmp/test.cpp -o /tftpboot/hw
Last der ausführbare an das Ziel; dann die Ausgabe auf dem Ziel:
# ./hw
-sh: ./hw: Permission denied
# chmod +x ./hw
# ./hw
-sh: ./hw: not found
# ls -l ./hw
-rwxr-xr-x 1 root root 6103 Jan 1 03:40 ./hw
Es gibt mehr zu ihm: auf mit Distro Compiler bauen, wie arm-linux-gnueabi-g++ -march=armv7-a /tmp/test.cpp -o /tftpboot/hw
, die App läuft gut!
Ich verglichen ausführbare Dateien durch readelf -a -W /tftpboot/hw
, aber bemerkte nicht viel defference. I pasted both outputs here. Das einzige, was mir aufgefallen ist, sind Linien Version5 EABI, soft-float ABI
vs Version5 EABI
. Ich versuchte, den Unterschied zu entfernen, indem ich -mfloat-abi=softfp
und -mfloat-abi=soft
passierte, aber Compiler scheint es zu ignorieren. Ich nehme jedoch an, das ist nicht wirklich wichtig, wie Compiler nicht einmal warnt.
Ich dachte auch, vielleicht sh gibt diesen Fehler aus, wenn eine ausführbare Datei in irgendeiner Weise inkompatibel ist. Aber auf meinem Host-PC sehe ich einen anderen Fehler in diesem Fall, z.B .:
$ sh /tftpboot/hw
/tftpboot/hw: 1: /tftpboot/hw: Syntax error: word unexpected (expecting ")")
ähnlich http://stackoverflow.com/questions/14535897/buildroot-file-system-cross-compiling-dynamically-linked-application-fails-bu –