树莓派论坛

 找回密码
 立即注册

如何在树莓派2上编译gcc: raspbian jessie上gcc是armv6的?armv7的浮点什么的不就浪费?

domng 发表于 2016-1-24 11:41:25 | 显示全部楼层 |阅读模式
树莓派编译gcc的一些经验和问题。

突然想在树莓派上编译gcc了gcc -v 一看 到目前修改swap分区在1g大小。gcc正在编译中。。 make失败的一次是make 没敢加-jx  用了将近24小时!!!可还是不成功

  1. Using built-in specs.
  2. COLLECT_GCC=gcc
  3. COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
  4. Target: arm-linux-gnueabihf
  5. Configured with: ../src/configure -v --with-pkgversion='Raspbian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
  6. Thread model: posix
  7. gcc version 4.9.2 (Raspbian 4.9.2-10)
复制代码
with-arch=armv6with-fpu=vfp
树莓派2已经有vfp4了,不用可浪费了
遂改为neon-vfp4


安装上编译gcc需要的那三个东西后
我改后的configure为:(未验证勿用)
  1. ../gcc-5.3.0/configure -v --with-pkgversion='Raspbian 5.3.0' --enable-languages=c,c++,objc,obj-c++ --prefix=/usr --program-suffix=-5.3 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/5.3 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --with-arch-directory=arm  --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=neon-vfpv4 --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib --with-mpfr-include=/usr/local/include --with-mpfr-lib=/usr/local/lib --with-mpc-include=/usr/local/include --with-mpc-lib=/usr/local/lib
复制代码

domng  楼主| 发表于 2016-1-24 11:41:26 | 显示全部楼层
本来想保存草稿,,没想到竟然发表了。。


目前有两个疑惑:
编译gcc的gcc是armv6  编译出来的是不是就是兼容armv6的而不是纯armv7??

交叉编译能不能对 gcc用??(交叉编译好像很麻烦的样子。。)
domng  楼主| 发表于 2016-1-24 11:42:32 | 显示全部楼层
gcc里 java、Fortran什么的我用不到就删了。。
domng  楼主| 发表于 2016-1-24 12:13:52 | 显示全部楼层
现在编译失败了。。

  1. ^CMakefile:1065: recipe for target 'insn-recog.o' failed
  2. make[3]: *** [insn-recog.o] Interrupt
  3. Makefile:1065: recipe for target 'df-core.o' failed
  4. make[3]: *** [df-core.o] Interrupt
  5. Makefile:1065: recipe for target 'df-problems.o' failed
  6. make[3]: *** [df-problems.o] Interrupt
  7. Makefile:1065: recipe for target 'df-scan.o' failed
  8. make[3]: *** [df-scan.o] Interrupt
  9. make[3]: *** Deleting intermediate file 'gcc.pod'
  10. Makefile:4407: recipe for target 'all-stage2-gcc' failed
  11. make[2]: *** [all-stage2-gcc] Interrupt
  12. Makefile:19125: recipe for target 'stage2-bubble' failed
  13. make[1]: *** [stage2-bubble] Interrupt
  14. Makefile:899: recipe for target 'all' failed
  15. make: *** [all] Interrupt
复制代码
domng  楼主| 发表于 2016-1-29 01:10:47 | 显示全部楼层
再顶~~~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版 | Archiver | 树莓派论坛 ( 粤ICP备15075382号-1 )