安装gcc5.4.0
程序员文章站
2022-07-10 23:31:26
...
安装gcc5.4.0
安装gcc-5.4.0时会遇到一些依赖问题,我将会需要安装的依赖基本都描述出来
1.binutils-2.32
cd binutils-2.32
mkdir build
cd build
../configure --prefix=/usr
make
make install
2.autoconf-2.69
cd autoconf-2.69
mkdir build
cd build
../configure --prefix=/usr
make
make install
3.autoconf-2.69
cd autoconf-2.69
mkdir build
cd build
../configure --prefix=/usr
make
make install
接着安装gmp-6.2.0,mpfr-4.1.0,mpc-1.2.0,这三者有依赖关系,安装的顺序不要改变。这三个依赖我选择的版本较高,后面再升级gcc9的时候就可以直接用了。
4.gmp-6.2.0
cd gmp-6.2.0
mkdir build
cd build
../configure --prefix=/usr/local/gmp-6.2.0
make
make install
5.mpfr-4.1.0
cd mpfr-4.1.0
mkdir build
cd build
../configure --prefix=/usr/local/mpfr-4.1.0 --with-gmp=/usr/local/gmp-6.2.0
make
make install
6.mpc-1.2.0
cd mpc-1.2.0
mkdir build
cd build
../configure --prefix=/usr/local/mpc-1.2.0 --with-gmp=/usr/local/gmp-6.2.0 --with-mpfr=/usr/local/mpfr-4.1.0
make
make install
7.链接gmp,mpfr,mpc的库至、/usr/lib64
cd /usr/lib64
ln -s /usr/local/gmp-6.2.0/lib/libgmp.so .
ln -s /usr/local/gmp-6.2.0/lib/libgmp.so.10 .
ln -s /usr/local/mpfr-4.1.0/lib/libmpfr.so .
ln -s /usr/local/mpfr-4.1.0/lib/libmpfr.so.6 .
ln -s /usr/local/mpc-1.2.0/lib/libmpc.so .
ln -s /usr/local/mpc-1.2.0/lib/libmpc.so.3 .
8.安装gcc-5.4.0
cd gcc-5.4.0
mkdir build
cd build
../configure --with-mpc=/usr/local/mpc-1.2.0 --with-gmp=/usr/local/gmp-6.2.0 --with-mpfr=/usr/local/mpfr-4.1.0 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --prefix=/usr
make
make install
9.检测是否安装成功
gcc -v
g++ -v