ARM交叉编译错误 cannot find crt1.o:错误解决方案

  1. crt1.o: No such file or directory/opt/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find crti.o: No such file or directorycollect2: error: ld returned 1 exit statusmake: *** [busybox_unstripped] Error 1  


         我在实际开发一个项目中遇到了这个错误,花了我5天时间才发现问题并解决。出来混的 ,迟早都是要还的。最开始没有想到去理解编译器的原理,都想到直接图方便用了SBC的集成交叉编译工具链,在实际使用过程中遇到了这个问题。当时也没有去理解库加载编和执行过程中库加载的区别。即LD_LIBRARY和LIBRARY的去区别。后来才发现一个是运行加载,一个是编译加载,我们设置环境变量应该设置的为LD_LIBRARY。
出现这个错误,还有一种可能性是缺少库,但是出现这种问题,一般解决起来都容易。但是像这种交叉编译器放得路径不对的问题就很麻烦了。通过arm-none-linux-gnueabi-gcc -v这个命令,可以看到:


[plain]  view plain copy print ?
  1. Using built-in specs.  
  2. COLLECT_GCC=arm-none-linux-gnueabi-gcc  
  3. COLLECT_LTO_WRAPPER=/opt/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper  
  4. Target: arm-none-linux-gnueabi  
  5. Configured with: /scratch/jbrown/arm-linux/src/gcc-4.7-2012.09/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} -D__CS_SOURCERYGXX_MAJ__=2012 -D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=64 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery CodeBench Lite 2012.09-64' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/jbrown/arm-linux/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/jbrown/arm-linux/obj/pkg-2012.09-64-arm-none-linux-gnueabi/arm-2012.09-64-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-mpfr=/scratch/jbrown/arm-linux/obj/pkg-2012.09-64-arm-none-linux-gnueabi/arm-2012.09-64-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-mpc=/scratch/jbrown/arm-linux/obj/pkg-2012.09-64-arm-none-linux-gnueabi/arm-2012.09-64-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-ppl=/scratch/jbrown/arm-linux/obj/pkg-2012.09-64-arm-none-linux-gnueabi/arm-2012.09-64-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/jbrown/arm-linux/obj/pkg-2012.09-64-arm-none-linux-gnueabi/arm-2012.09-64-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-libelf=/scratch/jbrown/arm-linux/obj/pkg-2012.09-64-arm-none-linux-gnueabi/arm-2012.09-64-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --disable-libgomp --disable-libitm --enable-poison-system-directories --with-build-time-tools=/scratch/jbrown/arm-linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/jbrown/arm-linux/install/arm-none-linux-gnueabi/bin  
  6. Thread model: posix  
  7. gcc version 4.7.2 (Sourcery CodeBench Lite 2012.09-64)  



在上面可以找到gcc设置的安装路径为:
--prefix=/opt/codesourery
所以交叉编译器得放在/opt/codesourery这个位置上。后面为库放得位置。注意编译busybox的时候,应该设置sysroot为红色部分的代码。


转载出处:http://blog.csdn.net/lichangc/article/details/9109125

心得:

其他类似的交叉编译器具有相同的效果。关键是--prefix路径,即交叉编译器生成路径。。。 

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值