国产龙芯中标麒麟编译安装gcc10.1
程序员文章站
2024-03-21 17:58:16
...
原文地址:https://blog.csdn.net/peihexian/article/details/107283547
国产龙芯处理器,国产中标麒麟操作系统,测试一下最新的gcc 10能不能用,据说gcc10.1支持c++17,c++20语法,记录升级国产如下:
gcc 10.1源码下载地址:
https://ftp.gnu.org/gnu/gcc/gcc-10.1.0/
tar -xvf gcc-10.1.0.tar.gz 进行解压缩
cd gcc-10.1.0
./contrib/download_prerequisites 下载四个源码依赖包,因为是联网下载,过程会比较漫长,需要耐心等待
准备一下编译环境:
配置中科龙芯源,vi /etc/yum.repos.d/zhongke.repo
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://ftp.loongnix.org/os/loongnix/1.0/os/
enabled=1
metadata_expire=7d
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
failovermethod=priority
baseurl=http://ftp.loongnix.org/os/loongnix/1.0/debug/
enabled=0
metadata_expire=7d
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[fedora-source]
name=Fedora $releasever - Source
failovermethod=priority
baseurl=http://ftp.loongnix.org/os/loongnix/1.0/SRPMS/
enabled=1
metadata_expire=7d
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
yum clean all
yum makecache
yum install glibc-devel.mipsn32el
回到解压缩以后的gcc10.1源码路径,创建build文件夹
mkdir build
cd build
../configure -v --build=mips64el-neokylin-linux-gnu --host=mips64el-neokylin-linux-gnu --target=mips64el-neokylin-linux-gnu --prefix=/usr/local/gcc-10.1.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib
sudo nohup make -j4 &
tail -f nohup.out 有事忙的话就ctrl+c干别的去就行了。
编译的过程中有个错误提示:如上图,解决办法如下: