升级gcc

升级至5.4

下载介质

安装依赖

tar zxvf gmp-4.3.2.tar.gz
cd gmp-4.3.2
./configure --prefix=/usr/local/gmp-4.3.2 \
&& make -j $(nproc) && make install && cd -

tar zxvf mpfr-2.4.2.tar.gz
cd mpfr-2.4.2
./configure --prefix=/usr/local/mpfr-2.4.2 \
--with-gmp=/usr/local/gmp-4.3.2 \
&& make -j $(nproc) && make install && cd -

tar zxvfv mpc-1.0.1.tar.gz
cd mpc-1.0.1
./configure --prefix=/usr/local/mpc-1.0.1 \
--with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 \
&& make -j $(nproc) && make install && cd -

配置环境变量

echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/gmp-4.3.2/lib:/usr/local/mpc-1.0.1/lib:/usr/local/mpfr-2.4.2/lib" >> /etc/profile
. /etc/profile

编译gcc

tar -xzvf gcc-5.4.0.tar.gz && mkdir gcc-5.4.0/gcc-build && cd gcc-5.4.0/gcc-build \
&& ../configure --prefix=/usr/local/gcc-5.4.0 --enable-threads=posix \
--disable-checking --disable-multilib --enable-languages=c,c++ \
--with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 \
--with-mpc=/usr/local/mpc-1.0.1 && make -j $(nproc) && make install && cd -

备份更新

mkdir -p /usr/local/bakup/gcc
mv /usr/bin/{gcc,g++} /usr/local/bakup/gcc/
cp /usr/local/gcc-5.4.0/bin/gcc /usr/bin/gcc
cp /usr/local/gcc-5.4.0/bin/g++ /usr/bin/g++
Copyright © weiliang 2021 all right reserved,powered by Gitbook本书发布时间: 2024-04-22 16:03:41

results matching ""

    No results matching ""