centos7安装arm-linux-gcc-4.4.3交叉编译器

本文详细介绍了如何在CentOS系统上搭建arm-linux-gcc交叉编译环境,包括下载、解压、配置环境变量及解决常见错误的过程。

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

(1)下载arm-linux-gcc-4.4.3
下载地址:http://download.csdn.net/download/cqflxyyyyyyy/3690145#comment

用上传工具上传 ,注意用二进制传输

(2)解压缩
解压,在当前目录下生成一个opt文件夹

tar -zxvf arm-linux-gcc-4.4.3-20100728.tar.gz

(3) 新建arm文件夹
在/usr/local/下建立一个名为arm的文件夹,在终端中输入命令:cd /usr/local/,回车,然后再输入命令:mkdir arm,建立arm目录,并修改该文件夹的属性为rwx,输入命令:chmod 777 arm

cd /usr/local/
mkdir arm
chmod 777 arm

(4)拷贝文件内容到新建目录下
 

[user@localhost]$ cp -r /opt/FriendlyARM/toolschain/4.4.3  /usr/local/arm

(5)拷贝文件内容到新建目录下
修改一下环境变量PATH,避免每次使用arm-linux-gcc时都要输入它所在的完整路径。在终端中输入:vi /etc/profile,打开profile文件,在最后一行加上“export PATH=$PATH:/usr/local/arm/4.4.3/bin”然后保存文件。
 

vi /etc/profile

unset i
unset -f pathmunge
export PATH=$PATH:/usr/local/arm/4.4.3/bin

(6)使新的环境变量立即生效,输入:source /etc/profile

source /etc/profile


(7)检查是否安装完成,输入:arm-linux-gcc -v查看版本信息

# arm-linux-gcc -v

若centos为32位系统则会直接安装成功,则会显示如下信息:

Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/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)

若centos系统为64位时,则会提示一下内容

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

表示没有安装成功,此时则需要做如下操作:

1、在64系统里执行32位程序如果出现/lib/ld-linux.so.2: 

bad ELF interpreter: No such file or directory,安装下glic即可

 则需要

输入命令:

#  yum install glibc.i686

 

2、如果出现error while loading shared libraries: libz.so.1: 

cannot open shared object file: No such file or directory

则需要

输入命令:

#  yum install zlib.i686

3、如果出现 /libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1: 

error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

则需要

输入命令:

#  yum -y install libstdc*

 

另外若当有缺少共享库的报错:
 
error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

解决办法:
 1、输入命令:

# yum whatprovides libstdc++.so.6

然后会提示哪个安装包有这个库文件如下:
 
[root@localhost ~]# yum whatprovides libstdc++.so.6
 Loaded plugins: aliases, changelog, downloadonly, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify,
              : versionlock
 Loading support for CentOS kernel ABI
 Loading mirror speeds from cached hostfile
  * base: centos.ustc.edu.cn
  * centosplus: centos.ustc.edu.cn
  * contrib: centos.ustc.edu.cn
  * extras: centos.ustc.edu.cn
  * updates: centos.ustc.edu.cn
 libstdc++-4.4.7-3.el6.i686 : GNU Standard C++ Library
 Repo        : base
 Matched from:
 Other      : libstdc++.so.6

2、然后执行:
 
输入命令:# yum install
libstdc++-4.4.7-3.el6.i686

搞定!

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值