【软件安装】c++11安装

#!/bin/bash

yum install -y zip* unzip* wget* gdb lrzsz

#gmp安装
cd /tmp
wget ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2  
tar -jxvf gmp-6.1.0.tar.bz2
cd gmp-6.1.0
./configure --prefix=/usr/local/gmp-6.1.0
make && make install
cp /usr/local/gmp-6.1.0/lib/* /usr/lib64

#mpfr安装
cd /tmp
wget http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
tar -jxvf mpfr-3.1.4.tar.bz2 
cd mpfr-3.1.4
mkdir temp
cd temp
../configure --prefix=/usr/local/mpfr-3.1.4 --with-gmp=/usr/local/gmp-6.1.0
make
make install
cp /usr/local/mpfr-3.1.4/lib/* /usr/lib64

#mpc安装
cd /tmp
wget http://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
tar -xzvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
mkdir temp
cd temp
../configure --prefix=/usr/local/mpc-1.0.3  --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4
make
make install
cp /usr/local/mpc-1.0.3/lib/* /usr/lib64

#gcc安装
cd /tmp
wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
tar -xzvf gcc-7.3.0.tar.gz
cd gcc-7.3.0
mkdir temp
cd temp
../configure --prefix=/usr/local/gcc-7.3.0  -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++ --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4 --with-mpc=/usr/local/mpc-1.0.3
make
make install
cp  /usr/local/gcc-7.3.0/lib64/libstdc++*  /usr/lib64/
export PATH=/usr/local/gcc-7.3.0/bin:$PATH

mv /usr/lib64/libstdc++.so /usr/lib64/libstdc++_back.so
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++_back.so.6

ln -s /usr/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so

mv /usr/bin/gcc /usr/bin/gcc_back
mv /usr/bin/g++ /usr/bin/g++_back
mv /usr/bin/cc /usr/bin/cc_back
mv /usr/bin/c++ /usr/bin/c++_back

ln -s /usr/local/gcc-7.3.0/bin/gcc /usr/bin/gcc
ln -s /usr/local/gcc-7.3.0/bin/g++ /usr/bin/g++
ln -s /usr/local/gcc-7.3.0/bin/cc /usr/bin/cc
ln -s /usr/local/gcc-7.3.0/bin/c++ /usr/bin/c++

 

你可能感兴趣的:(软件安装,linux)