programing tip

CentOS 7.2에서 yum으로 gcc 5.3을 설치하는 방법은 무엇입니까?

itbloger 2020. 9. 18. 07:52
반응형

CentOS 7.2에서 yum으로 gcc 5.3을 설치하는 방법은 무엇입니까?


CentOS 7.2를 사용하고 있습니다.

를 사용할 때 yum groupinstall "Development Tools"gcc 버전은 다음과 같이 4.8.5입니다.

여기에 이미지 설명 입력

gcc 5.3을 설치하고 싶습니다.

이것에 접근하는 방법 yum?


업데이트 :
종종 사람들은 최신 버전의 gcc를 원하고 devtoolset은 최신 상태로 유지되고 있으므로 devtoolset-N을 원할 수 있습니다. 여기서 N = {4,5,6,7 ...}, yum에서 시스템에서 사용 가능한 최신). N = 7에 대한 아래 cmd를 업데이트했습니다.

예를 들어 devtoolset-7 용 gcc-7.2.1 용 패키지가 있습니다. 먼저 소프트웨어 컬렉션 을 활성화해야합니다 . 그런 다음 devtoolset-7에서 사용할 수 있습니다.

sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
which gcc
gcc --version

업데이트 : 최신 버전의 gcc 9 설치 : ( gcc 9.2.0 ) -2019 년 8 월 12 일 출시 :

Download file: https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz

Compile and install:

//required libraries:
yum install libmpc-devel mpfr-devel gmp-devel

yum install zlib-devel*

./configure --with-system-zlib --disable-multilib --enable-languages=c,c++

make -j 8 <== this may take around 70 minutes or less to finish with 8 threads
              (depending on your cpu speed)

make install

Result: gcc 9.2.0 and g++ 9.2.0

여기에 이미지 설명 입력

Installing gcc 7.4 (gcc 7.4.0) - released December 6, 2018:

Download file: https://ftp.gnu.org/gnu/gcc/gcc-7.4.0/gcc-7.4.0.tar.gz

Compile and install:

//required libraries:
yum install libmpc-devel mpfr-devel gmp-devel

./configure --with-system-zlib --disable-multilib --enable-languages=c,c++

make -j 8 <== this may take around 50 minutes or less to finish with 8 threads
              (depending on your cpu speed)


make install

Result:

여기에 이미지 설명 입력

Notes:

1. This Stack Overflow answer will help to see how to verify the downloaded source file.

2. Use the option --prefix to install gcc to another directory other than the default one. The toplevel installation directory defaults to /usr/local. Read about gcc installation options


The best approach to use yum and update your devtoolset is to utilize the CentOS SCLo RH Testing repository.

yum install centos-release-scl-rh
yum --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc devtoolset-7-gcc-c++

Many additional packages are also available, to see them all

yum --enablerepo=centos-sclo-rh-testing list devtoolset-7*

You can use this method to install any dev tool version, just swap the 7 for your desired version. devtoolset-6-gcc, devtoolset-5-gcc etc.


You can use the centos-sclo-rh-testing repo to install GCC v7 without having to compile it forever, also enable V7 by default and let you switch between different versions if required.

sudo yum install -y yum-utils centos-release-scl;
sudo yum -y --enablerepo=centos-sclo-rh-testing install devtoolset-7-gcc;
echo "source /opt/rh/devtoolset-7/enable" | sudo tee -a /etc/profile;
source /opt/rh/devtoolset-7/enable;
gcc --version;

Command to install GCC and Development Tools on a CentOS / RHEL 7 server

Type the following yum command as root user:

yum group install "Development Tools"

OR

sudo yum group install "Development Tools"

If above command failed, try:

yum groupinstall "Development Tools"

참고URL : https://stackoverflow.com/questions/36327805/how-to-install-gcc-5-3-with-yum-on-centos-7-2

반응형