链接器找不到 crti.o 和其他对象文件



我正在将此 Makefile 用于一个小型项目,即使我在 /usr/lib/x86_64-linux-gnucrti.ocrtbegin.ocrt0.o,并且在LIBRARY_PATHLD_LIBRARY_PATH中都有该目录,我在运行make时仍然收到以下错误:

[LD]    balloons-Parafoil.elf
/afs/.ir.stanford.edu/users/e/r/ericmark/Development/balloons-
Parafoil/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-
none-eabi/bin/ld: cannot find crti.o: No such file or directory
/afs/.ir.stanford.edu/users/e/r/ericmark/Development/balloons-
Parafoil/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-
none-eabi/bin/ld: cannot find crtbegin.o: No such file or directory
/afs/.ir.stanford.edu/users/e/r/ericmark/Development/balloons-
Parafoil/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-
none-eabi/bin/ld: cannot find crt0.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [balloons-Parafoil.elf] Error 1

应该注意,此错误发生在我尝试过的两台 Ubuntu 机器上,但不发生在我正在开发的 macOS 机器上。

C 运行时文件(如 crti.o(是高度特定于计算机的。 不能使用 /usr/lib/x86_64-linux-gnu 中找到的 x86-64 版本来创建 ARM 二进制文件。 对于要面向的 32 位 ARM 变体,需要这些文件的版本。 查看 Canonical 下载页面,看起来当前的 Ubuntu 不再支持 32 位 ARM,但您可以在启用相关的 Debian 存储库后安装libc6-dev:armel。 也可能您使用的工具链设置不正确。

此外,如果你的ARM工具链以裸机为目标,glibc对你没有用,因为glibc假设有一个正在运行的Linux内核可以使用。

最新更新