ld: 找不到 crt1.o: 没有那个文件或目录

ld: cannot find crt1.o: No such file or directory

我正在使用 bitbake 交叉编译 yocto build 中的 arm 申请。编译正常,但 linking 失败并出现以下错误。

/gcc/arm-poky-linux-gnueabi/5.3.0/ld: cannot find crt1.o: No such file or directory

它也无法 link 其他文件 crti.o 和 crtbegin.o。我不确定需要在 LDFLAGS 中添加哪个目录。它是在寻找 arm toolchain lib 目录还是 gcc lib 目录?

只需尝试使用 cc hello.c 进行简单的 puts("Hello world") 编译(没有其他选项)。如果仍然有同样的问题很可能是你的工具链安装错误,否则,检查链接器选项,可能你设置为找不到标准库。

希望对您有所帮助。