gcc-8.3.1安装(arm,Centos7)

环境
Centos7(Red Hat 8.3.1-3)
arm cpu

参考官网链接

一、简要步骤:

1、修改yum的Base源为国内源(比如清华源
2、make yum makecache
3、安装CentOS SCLo RH仓库(yum install centos-release-scl-rh)
4、安装yum包yum install devtoolset-8
5、设置默认gcc编译器(source /opt/rh/devtoolset-8/enable)
6、测试(gcc -v,g++ -v)

二、详细步骤

1、修改yum的Base源为清华源,注意选arm的(centos-altarch镜像),默认是x86的
附上文件CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos-altarch.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos-altarch.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos-altarch.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centos-altarchplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/$releasever/centos-altarchplus/$basearch/
#mirrorlist=http://mirrorlist.centos-altarch.org/?release=$releasever&arch=$basearch&repo=centos-altarchplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

2、运行命令sudo make yum makecache
3、安装CentOS SCLo RH仓库,参考链接

yum install centos-release-scl-rh

在这里插入图片描述

在这里插入图片描述
4、安装yum包

yum install devtoolset-8-gcc-plugin-devel

安装成功的参考截图如下
在这里插入图片描述

5、设置默认的编译器

# scl enable devtoolset-8 bash
bash-4.2# gcc -v

6、测试

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/aarch64-redhat-linux/8/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-8/root/usr --mandir=/opt/rh/devtoolset-8/root/usr/share/man --infodir=/opt/rh/devtoolset-8/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-8.3.1-20190311/obj-aarch64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)

7、写入配置文件,自动切换编译器

echo "source /opt/rh/devtoolset-8/enable" > ~/.bashrc
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值