Using crosstool-ng to generate cross-compiler for ARM

本文详细介绍了如何在Ubuntu环境下使用crosstool-ng工具进行跨平台编译器配置与构建的过程,包括环境设置、编译安装步骤以及配置选项的调整,最终成功构建了适用于特定目标处理器的交叉编译器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[Reference] 

 

[Environment setting] 

Ubuntu-10.04 

 

apt-get install gperf 

apt-get install texinfo 

apt-get install libtool 

apt-get install automake 

 

apt-get install gcj 

apt-get install g++ 

apt-get install libexpat-dev 

 

apt-get install gawk 

apt-get install cvs 

 

[compile and install crosstool-ng] 

./configure --prefix=<install dir> 

make  

make install 

 

[menu config change] 

$ct-ng menuconfig 

 

Paths and misc options  ---> 

      (${HOME}/development/crosstool-ng/src) Local tarballs directory   保存源码包路径 

      (${HOME}/development/x-tools/${CT_TARGET}) Prefix directory  交叉编译器的安装路径 

 

Target options  --->     从datasheet中的 BLOCK DIAGRAM 中可以看到 

           *** Targ:et optimisations *** 

           (armv4t) Architecture level  

           (arm9tdmi) Emit assembly for CPU     

           (arm920t) Tune for CPU 

 

[Start building] 

$ct-ng build 

 

Error resolving: 

[1] Resolve: Need to update gcc from 4.1 to 4.4 

[DEBUG]    ==> Executing: 'CC_FOR_BUILD=i686-build_pc-linux-gnu-gcc' 'CFLAGS= -pipe ' 'LDFLAGS=-lstdc++ -lm' '/home/eric/work/crosstool-ng/test/.build/src/gcc-4.3.2/configure' '--build=i686-build_pc-linux-gnu' '--host=i686-build_pc-linux-gnu' '--target=arm-unknown-linux-gnueabi' '--prefix=/home/eric/work/crosstool-ng/test/.build/arm-unknown-linux-gnueabi/buildtools' '--with-local-prefix=/home/eric/work/crosstool-ng/out/arm-unknown-linux-gnueabi/sysroot' '--disable-libmudflap' '--with-sysroot=/home/eric/work/crosstool-ng/out/arm-unknown-linux-gnueabi/sysroot' '--with-newlib' '--enable-threads=no' '--disable-shared' '--with-pkgversion=crosstool-NG 1.15.2' '--with-arch=armv4t' '--with-cpu=arm9tdmi' '--with-tune=arm920t' '--with-float=soft' '--enable-__cxa_atexit' '--with-gmp=/home/eric/work/crosstool-ng/test/.build/arm-unknown-linux-gnueabi/buildtools' '--with-mpfr=/home/eric/work/crosstool-ng/test/.build/arm-unknown-linux-gnueabi/buildtools' '--enable-target-optspace' '--disable-libgomp' '--disable-libmudflap' '--disable-nls' '--disable-multilib' '--enable-languages=c'  

[CFG  ]    checking build system type... i686-build_pc-linux-gnu 

[CFG  ]    checking host system type... i686-build_pc-linux-gnu 

[CFG  ]    checking target system type... arm-unknown-linux-gnueabi 

[CFG  ]    checking for a BSD-compatible install... /home/eric/work/crosstool-ng/test/.build/tools/bin/install -c 

[CFG  ]    checking whether ln works... yes 

[CFG  ]    checking whether ln -s works... yes 

[CFG  ]    checking for i686-build_pc-linux-gnu-gcc... i686-build_pc-linux-gnu-gcc 

[ERROR]    checking for C compiler default output file name... configure: error: C compiler cannot create executables 

[CFG  ]    See `config.log' for more details. 

[ERROR]   

[ERROR]  >> 

[ERROR]  >>  Build failed in step 'Installing pass-1 core C compiler' 

[ERROR]  >>        called in step '(top-level)' 

[ERROR]  >> 

[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@172] 

[ERROR]  >>        called from: do_cc_core_backend[scripts/build/cc/gcc.sh@359] 

[ERROR]  >>        called from: do_cc_core_pass_1[scripts/build/cc/gcc.sh@97] 

[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@598] 

[ERROR]  >> 

[ERROR]  >>  For more info on this error, look at the file: 'build.log' 

[ERROR]  >>  There is a list of known issues, some with workarounds, in: 

[ERROR]  >>      '/home/eric/work/crosstool-ng/crosstool-ng-1.15.2-bin/share/doc/crosstool-ng/ct-ng.1.15.2/B - Known issues.txt' 

[ERROR]   

[ERROR]  (elapsed: 5:44.22)


[Test]

<2012-08-04 success!> 

Kernel: linux2.6.32.2 

Busybox: 1.1.3 

Config file for crosstool-ng-1.15.3

http://pan.baidu.com/share/link?shareid=119109&uk=822921326

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值