我有以下问题:GCC - 编译另一台机器不工作
- 我有遗留系统 - ARM CPU。
- 在遗留系统上,我没有开发库,也没有GCC。
- 在遗留系统上,我没有足够的资源(主要是RAM和SWAP不可能)编译。
我需要编译非常简单的程序,我有源代码。当我与以下GCC命令编译另一台计算机也有ARM CPU(有点新)上:
gcc -mcpu=arm920t -march=armv4t -o app app.c
(-mcpu和-march设置为遗留系统的CPU)
当我复制这个编译文件遗留系统,使其可执行文件,并尝试运行它,我得到以下信息:
$ ./app
-sh: ./app: No such file or directory
$ ls -lah
total 237K
drwxr-xr-x 2 root root 0 Apr 4 07:35 .
drwxr-xr-x 4 root root 0 Dec 31 1969 ..
-rwxr-xr-x 1 root root 108K Mar 14 09:23 app
$
没有与路径没有问题,分区不装有NOEXEC选项。当我将任何系统(例如cat)文件复制到同一个目录时,我可以毫无问题地启动它。
这里是应用我之间(第一个结果)和应用程序的区别编译,这是已经在系统(第二结果):
$ readelf -h app
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0xa278
Start of program headers: 52 (bytes into file)
Start of section headers: 100104 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 10
Size of section headers: 40 (bytes)
Number of section headers: 38
Section header string table index: 35
$
和:
输出file cat app
的
$ readelf -h cat
ELF Header:
Magic: 7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: ARM
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x8c34
Start of program headers: 52 (bytes into file)
Start of section headers: 15220 (bytes into file)
Flags: 0x2, has entry point, GNU EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 24
Section header string table index: 23
$
:
app: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
cat: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.2.0, stripped
我不确定这里有什么问题,因为即使应用程序是wro ngly编译我期待得到不同的错误信息比'没有这样的文件或目录'。
的“版本5来完成ABI'与'GNU EABI'可能会造成一些麻烦。什么'文件猫应用程序'不得不说?如果答案不一致,则需要追踪有什么不同。 – 2013-04-04 16:26:29
app:GNF/Linux 2.6的ELF 32位LSB可执行文件,ARM版本1(SYSV),动态链接(使用共享库)。16,未去除 --- cat:ELF 32位LSB可执行文件,ARM版本1,动态链接(使用共享库),用于GNU/Linux 2.2.0,去掉了 我可以看到3个区别: - 我的应用程序没有剥离(据我所知这不是一个问题,因为即使当我sti它时,我也有同样的问题)。 - 我的应用程序有更新的GNU/Linux专业化。 - 对于我的应用程序,提到了SYSV,我不知道这是什么,如何在没有它的情况下编译应用程序:( – LukasH 2013-04-06 14:39:50
它看起来像目标机器没有GNU/Linux专业化所需的支持,除非你能找到一个工作二进制文件在相同类型的目标上,你运气不好,既可以升级目标支持,也可以只使用目标已经支持的内容.. – 2013-04-06 15:30:41