在64位centos下配置ARM32位交叉编译环境

tab键:

CentOS7系统tab命令补全

bash-completion

在新安装的CentOS7系统中,如果没有安装命令补全的话,在systemctl管理服务的时候就没法用tab来自动补全,因此在安装完系统后,我们要再安装命令补全这个软件:

yum -y install bash-completion

注意,再安装完之后还需要重新登陆一次shell终端才能生效哦!!

1、拷贝文件到系统opt文件夹下

2、解压

命令:tar -jxvf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2

3、配置系统环境变量

 命令:vim /etc/profile   

命令:i

在末尾添加

export PATH=$PATH:/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin

命令:esc键》:》wq》回车

4、使命令生效

source /etc/profile 使环境变量生效

5、安装32位的库要和本地的64位版本一直

查看那个库含文件:yum provides libstdc++.so.6

然后把本机的版本升级  

error:

Protected multilib versions: libstdc++-4.8.5-44.el7.i686 != libstdc++-4.8.5-39.el7.x86_64

yum update libstdc++-4.8.5-44.el7.x86_64 -y

yum update libstdc++-8.5.0-44.el7.x86_64 -y

安装:

yum install libstdc++-4.8.5-44.el7.i686

 errot

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

centos8 Repository epel is listed more than once in the configuration - _海阔天空 - 博客园

centos镜像-centos下载地址-centos安装教程-阿里巴巴开源镜像站

CentOS,是基于 Red Hat Linux 提供的可自由使用源代码的企业级 Linux 发行版本;是一个稳定,可预测,可管理和可复制的免费企业级计算平台。

下载地址: 阿里云开源镜像站资源目录
阿里云开源镜像站资源目录

配置方法

1. 备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

centos8(centos8官方源已下线,建议切换centos-vault源)

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

3. 运行 yum makecache 生成缓存

4. 其他

非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg:

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentO

Error: Transaction check error:  安装的32位版本和本地64位版本不一致
  file /usr/share/gcc-8/python/libstdcxx/v6/__pycache__/printers.cpython-36.opt-1.pyc from install of libstdc++-8.3.1-5.1.el8.i686 conflicts with file from package libstdc++-8.2.1-3.5.el8.x86_64
  file /usr/share/gcc-8/python/libstdcxx/v6/__pycache__/printers.cpython-36.pyc from install of libstdc++-8.3.1-5.1.el8.i686 conflicts with file from package libstdc++-8.2.1-3.5.el8.x86_64
  file /usr/share/gcc-8/python/libstdcxx/v6/__pycache__/xmethods.cpython-36.opt-1.pyc from install of libstdc++-8.3.1-5.1.el8.i686 conflicts with file from package libstdc++-8.2.1-3.5.el8.x86_64
  file /usr/share/gcc-8/python/libstdcxx/v6/__pycache__/xmethods.cpython-36.pyc from install of libstdc++-8.3.1-5.1.el8.i686 conflicts with file from package libstdc++-8.2.1-3.5.el8.x86_64
  file /usr/share/gcc-8/python/libstdcxx/v6/printers.py from install of libstdc++-8.3.1-5.1.el8.i686 conflicts with file from package libstdc++-8.2.1-3.5.el8.x86_64
  file /usr/share/gcc-8/python/libstdcxx/v6/xmethods.py from install of libstdc++-8.3.1-5.1.el8.i686 conflicts with file from package libstdc++-8.2.1-3.5.el8.x86_64

error

-bash: /opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-gcc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
命令:sudo yum install glibc.i686

6.  /bin/arm-linux-gnueabihf-gcc: No such file or directory

得按装32位库

Centos8安装32位编译环境

Centos8安装32位编译环境

安装32位glibc库文件命令:(安装C库文件)

sudo yum install glibc-devel.i686

安装32位glibc++库文件命令

sudo  yum install libstdc++-devel.i686

5、查看命令生效情况

在终端上输入命令arm-linux-gnueabihf-gcc -v
看到下面内容说明成功了

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/../libexec/gcc/arm-linux-gnueabihf/4.7.3/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/gcc-linaro-4.7-2013.03/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install --with-sysroot=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran --enable-multilib --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-ppl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-host-libstdcxx='-L/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static/lib -lpwl' --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-gold --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long --with-mode=thumb
Thread model: posix

6、安装编译共享32位库

在centos6.7 X64位机器上:

yum install xulrunner.i686

yum install libXtst.i686

错误:

在使用yum命令时 

No match for argument: 

Error: Unable to find a match 

问题应该是没有配置 yum 源,所以解决办法就是:安装 EPEL 源

centos8:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dodo_code

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值