CentOS 6.10 에 GCC 9.2.0 설치

설치 환경
1. 운영 체제: CentOS 6.10
2. GMP: 버 전 6.2.0, 다운로드 링크:https://gmplib.org/download/gmp/gmp-6.2.0.tar.xz
3. MPC: 버 전 1.1.0, 다운로드 링크:http://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
4. MPFR: 버 전 4.0.2, 다운로드 링크:https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.xz
5. GCC: 버 전 9.2.0, 다운로드 링크:http://mirror.hust.edu.cn/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
2. 상기 파일 의 최신 버 전 다운로드
3. 설치 스 크 립 트 는 다음 과 같 습 니 다.
폴 더 를 만 든 다음 이 네 개의 파일 을 모두 이 폴 더 아래 에 복사 합 니 다.그리고 su root, 아래 부분 을 스 크 립 트 파일 build. sh 로 만 듭 니 다.
#!/bin/bash
dir=$(pwd)
echo $dir

cd $dir
rm -rf gmp-6.2.0
tar -xf gmp-6.2.0.tar.xz
cd gmp-6.2.0
./configure --disable-shared --enable-static --prefix=$dir/extern
make && make install
echo "----------------gmp-6.2.0 over------------------"

cd $dir
rm -rf mpfr-4.0.2
tar -xf mpfr-4.0.2.tar.xz
cd mpfr-4.0.2
./configure --disable-shared --enable-static --prefix=$dir/extern --with-gmp=$dir/extern
make && make install
echo "----------------mpfr-4.0.2 over------------------"

cd $dir
rm -rf mpc-1.1.0
tar -xf mpc-1.1.0.tar.gz
cd mpc-1.1.0
./configure --disable-shared --enable-static --prefix=$dir/extern --with-gmp=$dir/extern --with-mpfr=$dir/extern
make && make install
echo "----------------mpc-1.1.0 over------------------"

cd $dir
rm -rf gcc-9.2.0
tar -xf gcc-9.2.0.tar.xz
cd gcc-9.2.0
./configure --prefix=/usr/local/gcc --with-gmp=$dir/extern --with-mpfr=$dir/extern --with-mpc=$dir/extern --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j2
make install

위 스 크 립 트 파일 을 실행 합 니 다.잠시 만 기다 리 면 최신 gcc 9.2.0 을 시스템 에 설치 할 수 있 습 니 다.
4. 설치 가 완 료 된 후에 관련 환경 설정 도 해 야 합 니 다.
내 설치 폴 더 는 / usr / local / gcc 입 니 다. 설정 은 다음 과 같 습 니 다.
#!/bin/bash
gccDir=/usr/local/gcc
rm -f /etc/profile.d/gcc.sh
echo "export PATH=$gccDir/bin:\$PATH" >>/etc/profile.d/gcc.sh
source /etc/profile.d/gcc.sh
gcc -v
echo "----------gcc bin path ok-----------"

rm -f /usr/include/gcc
ln -sv $gccDir/include/ /usr/include/gcc
echo "----------gcc include path ok-----------"

rm -f /etc/ld.so.conf.d/gcc.conf
echo "$gccDir/lib64" >>/etc/ld.so.conf.d/gcc.conf
ldconfig -v >>out
rm -f out
ldconfig -p |grep gcc
echo "----------gcc lib64 path ok-----------"

좋은 웹페이지 즐겨찾기