【问题标题】:ld: cannot find crt1.o: No such file or directoryld: 找不到 crt1.o: 没有这样的文件或目录
【发布时间】:2017-03-07 02:19:17
【问题描述】:

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

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

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

【问题讨论】:

  • 您为什么不尝试搜索相关文件?在我的电脑(不同的工具链)上,它位于 {...}\arm-unknown-linux-gnu\sys-root\usr\lib\crt1.o

标签: c gcc arm cross-platform bitbake


【解决方案1】:

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

希望对你有帮助。

【讨论】:

  • 编译器在标准路径 /usr/lib/ 而不是工具链的 /usr/lib 目录中寻找库文件。鉴于 --sysroot=${STAGING_DIR_TARGET}/ 这反过来有助于找到目标路径。
猜你喜欢
  • 2017-10-23
  • 1970-01-01
  • 2021-06-03
  • 1970-01-01
  • 2021-12-31
  • 1970-01-01
  • 2022-06-17
  • 1970-01-01
  • 2022-10-22
相关资源
最近更新 更多