您的位置:首页 > 其它

基于Ubuntu12.04安装交叉编译环境

2017-11-22 15:49 204 查看
                         基于Ubuntu12.04安装交叉编译环境
 
最近刚刚接触嵌入式,通过借鉴前辈们的方法以及自己的实践,记录下来希望对你们有用!
本人用的是Ubuntu 12环境,使用的压缩包为arm-linux-gcc-4.4.3.tar
 
1.解压文件
我在/usr/local目录下新建了一个目录mkdir /usr/local/arm

tar xzvf arm-linux-gcc-4.4.3.tar /usr/local/arm

 

2.修改配置文件/etc/profile(这个文件属于系统级的环境变量,里面的东西对所有用户都适用)

vim /etc/profile

增加路径设置,在最后一行下面添加下面的代码:

Export PATH=&PATH:/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/bin

关于/opt/FriendlyARM/toolschain这几个目录是因为tar包解压后自动生成的

 

3.注册环境变量

执行此句:

source /etc/profile

 

4. 检查路径是否添加到PATH

执行此句

echo $PATH

显示内容为:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/opt/FriendlyARM/toolschain/4.4.3/bin说明已经将交叉编译的路径加入PATH

 

5. 测试是安装成功

方法一:另开一个终端,输入arm-,然后按两下Tab键,如果出现下列信息,则表明安装成功

[b]arm-linux-addr2line          arm-linux-g++         arm-linux-objcopyarm-linux-ar           arm-linux-gcc         arm-linux-objdumparm-linux-as           arm-linux-gcc-4.4.3       arm-linux-populatearm-linux-c++           arm-linux-gccbug        arm-linux-ranlibarm-linux-cc           arm-linux-gcov          arm-linux-readelfarm-linux-c++filt          arm-linux-gprof        arm-linux-sizearm-linux-cpp           arm-linux-ld          arm-linux-stringsarm-linux-ct-ng.config          arm-linux-nm          arm-linux-strip[/b]

[b] [/b]

方法二:在终端输入arm-linux-gcc -v

显示如下信息,则证明安装成功

Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440ild-toolschain/workingc/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.4.3 (ctng-1.6.1) 

 

此方法借鉴与http://www.cnblogs.com/tdyizhen1314/p/4124886.html

再次感谢
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: