- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下问题:
我需要编译我有源代码的非常简单的程序。当我使用以下 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
$
和:
$ 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
$
file cat app
的输出:
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
我不确定这里有什么问题,因为即使应用程序编译错误,我也希望得到与“没有这样的文件或目录”不同的错误消息。
最佳答案
这个问题主要是由于共享库libc问题。当你在支持gcc的arm机器上编译程序时,使用的库(libc)与你的目标不一样。所以首先检查主机和目标上的库。要交叉检查上面的评论,你可以试试这个。
gcc -static -o app app.c
现在将您的应用程序可执行文件复制到您的目标。在目标上执行,它将毫无问题地执行。检查上面静态编译的代码。利用文件应用程序或者ldd 应用程序。
如果你不想静态编译,那么从目标 rootfs 的/lib 复制你的库编译时提供目标库而不是主机库的库路径。这可以通过
LDFLAGS=-L/<path-to-target-lib> gcc -o app app.c
关于gcc - 为另一台机器编译不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15815972/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!