GCC10.1.0最新版编译
官網地址:https://gcc.gnu.org/
下載編譯
wget http://mirror.linux-ia64.org/gnu/gcc/releases/gcc-10.1.0/gcc-10.1.0.tar.gztar zxvf gcc-10.1.0.tar.gzcd gcc-10.1.0/mkdir buildcd build/../configure報錯,提示信息configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specifytheir locations. Source code for these libraries can be found attheir respective hosting sites as well as athttps://gcc.gnu.org/pub/gcc/infrastructure/. See alsohttp://gcc.gnu.org/install/prerequisites.html for additional info. Ifyou obtained GMP, MPFR and/or MPC from a vendor distribution package,make sure that you have installed both the libraries and the headerfiles. They may be located in separate packages.?
vi ../contrib/download_prerequisites
修改鏡像服務器地址
base_url='http://mirror.linux-ia64.org/gnu/gcc/infrastructure/'
?
接下來下載需要的文件
cd ../
bash contrib/download_prerequisites
可能運行較慢,看不到就著急啊……來,手動下載吧(文件名在contrib/download_prerequisites 里面有)
wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/gmp-6.1.0.tar.bz2wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/mpfr-3.1.4.tar.bz2wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/mpc-1.0.3.tar.gz#wget http://mirror.linux-ia64.org/gnu/gcc/infrastructure/isl-0.18.tar.bz2tar jxvf gmp-6.1.0.tar.bz2tar jxvf mpfr-3.1.4.tar.bz2tar zxvf mpc-1.0.3.tar.gz#tar jxvf isl-0.18.tar.bz2ln -s gmp-6.1.0 gmpln -s mpfr-3.1.4 mpfrln -s mpc-1.0.3 mpc再次
cd build/
../configure
如果報錯configure: error: I suspect your system does not have 32-bit
development libraries (libc and headers). If you have them,
rerun configure with --enable-multilib. If you do not have them,
and want to build a 64-bit-only compiler, rerun configure with
--disable-multilib.
也就是說,configure推斷本機沒有32位開發庫,如果的確有就加上--enable-multilib選項,否則就使用--disable-multilib選項只構建64位版本。
就改為
../configure --disable-multilib
生成Makefile后執行(-j 8代表8個線程)
make -j 8
……需要等待好久,吃個飯去吧
安裝
sudo make install
安裝完成后看下版本
gcc --version
g++ --version
都是10.1.0了
使用問題
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./bin/navicat-patcher)
解決
#首先找下新編譯的這個文件在哪里
find /usr/local -name "libstdc++.so.6"
#輸出/usr/local/lib64/libstdc++.so.6
#舊版文件備份
sudo mv /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.bak
#創建軟連接過去
sudo ln -s /usr/local/lib64/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#確認下GLIBCXX_3.4.26在不在輸出清單里
strings /usr/local/lib64/libstdc++.so.6 | grep GLIBC
?
?
總結
以上是生活随笔為你收集整理的GCC10.1.0最新版编译的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [elk]elasticsearch d
- 下一篇: 计算机软件水平考试中级题目,计算机软考中