主机OS:ubuntu10.04
目标机:arm
目的:支持armv4指令集的交叉编译工具链
参考网址:
http://blog.csdn.net/chen_zhongming/article/details/6680596
http://blog.csdn.net/eric_tao/article/details/8171680
然后,使用crosstool-ng1.9.3建立交叉工具链。之所以用crosstool-ng是因为crosstool-ng是新的用来建立交叉工具链的工具,它是crosstool的替换者。crosstool的gcc版本只能到4.1.1,无法编译版本高于2.6.29的linux内核。而crosstool-ng一直保持着更新,现在最新能够建立 gcc 4.3.2版本,可用来编译最新内核。
【出现错误】:
[INFO ] Installing binutils: done in 63.49s (at 02:53)
[INFO ] =================================================================
[INFO ] Installing static core C compiler
[EXTRA] Configuring static core C compiler
[ERROR] checking for C compiler default output file name... configure: error: C compiler cannot create executables
[ERROR] Build failed in step 'Installing static core C compiler'
[ERROR] Error happened in '/opt/crosstool-ng/lib/ct-ng-1.9.3/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)
[ERROR] called from '/opt/crosstool-ng/lib/ct-ng-1.9.3/scripts/build/cc/gcc.sh' at line # 203 in function 'do_cc_core'
[ERROR] called from '/opt/crosstool-ng/lib/ct-ng-1.9.3/scripts/build/cc/gcc.sh' at line # 52 in function 'do_cc_core_pass_1'
[ERROR] called from '/opt/crosstool-ng/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 597 in function 'main'
[ERROR] Look at '/opt/crosstool-ng/arm-unknown-linux-gnueabi/build.log' for more info on this error.
[ERROR] (elapsed: 2:52.53)
[02:53] / make[1]: *** [build] Error 77
make: *** [build.4] Error 2
root@iefswang-desktop:/home/crosstool-ng/build# vim /opt/crosstool-ng/arm-unknown-linux-gnueabi/build.log
【解决方法】:
ubuntu10.04默认使用 gcc4.1,将gcc升级为gcc4.4就可以编译通过。
apt-get install gcc-4.4
rm /usr/bin/gcc
ln -s /usr/bin/gcc-4.4 /usr/bin/gcc