程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> cannot find crt1.o:錯誤解決方案

cannot find crt1.o:錯誤解決方案

編輯:C++入門知識

[cpp]
/opt/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find 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 directory 
collect2: error: ld returned 1 exit status 
make: *** [busybox_unstripped] Error 1 

/opt/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find 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 directory
collect2: error: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1
這個錯誤我遇到了 ,解決了5天左右的時間。出來混的 ,遲早都是要還的。最還是沒有想到去理解編譯器的原理。和庫加載中編譯加載和執行加載的區別。LD_LIBRARY和LIBRARY的去區別。後來發現一個是運行加載,一個是編譯加載。

出現這個錯誤,可以能是缺少庫。但是還有一種情況,就是交叉編譯器放得路徑不對。通過arm-none-linux-gnueabi-gcc -v這個命令,可以看到:


[cpp]
Using built-in specs. 
COLLECT_GCC=arm-none-linux-gnueabi-gcc 
COLLECT_LTO_WRAPPER=/opt/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper 
Target: arm-none-linux-gnueabi 
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 <SPAN style="COLOR: #33ff33">--prefix=/opt/codesourcery </SPAN><SPAN style="COLOR: #ff0000">--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc</SPAN> --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  
Thread model: posix 
gcc version 4.7.2 (Sourcery CodeBench Lite 2012.09-64)  

Using built-in specs.
COLLECT_GCC=arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper
Target: arm-none-linux-gnueabi
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
Thread model: posix
gcc version 4.7.2 (Sourcery CodeBench Lite 2012.09-64) 可以看到上面兩種不同顏色標示的代碼,

--prefix=/opt/codesourery

為交叉編譯放得位置。後面為庫放得位置。注意編譯busybox的時候,應該設置sysroot為紅色部分的代碼。

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved