libstdc++.so.6: version `GLIBCXX_2.17' not found
原來是因為服務(wù)器的gcc版本太低巡通,所以需要升級gcc岳守,可是又沒有root權(quán)限,沒辦法用yum來直接把相關(guān)的依賴包全部裝好篓像,只能去下載源碼來一個一個編譯安裝。
需要安裝先后順序:gmp、mpfr片橡、mpc俄认、gcc 這四個庫。[鏈接](Index of /gnu/gmp/ (ustc.edu.cn)
)
./configure --prefix=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2
make
make install
./configure --prefix=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpfr-2.4.2 --with-gmp-include=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/include --with-gmp-lib=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/lib
make
make install
./configure --prefix=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpc-1.0.1 --with-gmp-include=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/include --with-gmp-lib=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/lib --with-mpfr-include=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpfr-2.4.2/include --with-mpfr-lib=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpfr-2.4.2/lib
make
make install
./configure --prefix=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gcc-4.7.2 --with-gmp-include=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/include --with-gmp-lib=/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/lib --with-mpfr-include=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpfr-2.4.2/include --with-mpfr-lib=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpfr-2.4.2/lib --with-mpc-include=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpc-1.0.1/include --with-mpc-lib=/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpc-1.0.1/lib
make
make install
修改~/.bashrc蒙揣,添加PATH和LD_LIBRARY_PATH
export PATH=裝gcc的路徑里的/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
export LD_LIBRARY_PATH=裝gcc的路徑里的/usr/local/lib64:$LD_LIBRARY_PATH
錯誤排除:
*** LIBRARY_PATH shouldn‘t contain the current directory when *** building gcc.
方法一:
重新export LIBRARY_PATH和C_INCLUDE_PATH 尾部不含冒號
方法二:
export LIBRARY_PATH=$(echo $LIBRARY_PATH | sed 's/:$//; s/^://;')
export C_INCLUDE_PATH=$(echo $C_INCLUDE_PATH | sed 's/:$//; s/^://;')
configure: error: cannot compute suffix of object files: cannot compile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpc-1.0.1/lib:/public1/home/stu_wanbeiyuan/software/glibc-2.27/gmp-4.3.2/lib:/public1/home/stu_wanbeiyuan/software/glibc-2.27/mpfr-2.4.2/lib
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
新編譯出來的程序無法在64位系統(tǒng)下運行靶溜,需要安裝
(沒有root, 有待解決。懒震。罩息。。个扰。瓷炮。)
yum install glibc-devel.i686 libstdc++-devel.i686