yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
update-alternatives --install /usr/bin/gcc-4.9 gcc-4.9 /opt/rh/devtoolset-3/root/usr/bin/gcc 10
update-alternatives --install /usr/bin/g++-4.9 g++-4.9 /opt/rh/devtoolset-3/root/usr/bin/g++ 10
Answer from Lars Bilke on Stack Overflowyum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
update-alternatives --install /usr/bin/gcc-4.9 gcc-4.9 /opt/rh/devtoolset-3/root/usr/bin/gcc 10
update-alternatives --install /usr/bin/g++-4.9 g++-4.9 /opt/rh/devtoolset-3/root/usr/bin/g++ 10
For installing the system compilers gcc, g++, the install command is # yum install gcc-c++ → Provides version 4.8.5 : /usr/bin/{ gcc, g++ }.
Other options: 1. gcc53-c++-5.3.0-1.el6.x86_64.rpm → https://drive.google.com/file/d/0B7S255p3kFXNRm9FVnZYUnhyZzg/view?usp=sharing&resourcekey=0-1N6zQa6Sbl_WycG1O9I7JA : Download and install : # cd Downloads/ && yum install ./gcc53-c++-5.3.0-1.el6.x86_64.rpm ..... Provides /usr/bin/{gcc53, g++53}.
- The devtoolset´s : https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/ →
# yum-config-manager --enable rhel-server-rhscl-7-rpms
Install gcc, g++ version 4.9.2 : # yum install devtoolset-3-gcc-c++
Note : You can have as many gcc/g++ versions as you want, installed at the same time. ( The system compilers are a must.)
- gcc49-c++-4.9.3-1.el6.x86_64.rpm https://drive.google.com/file/d/1Pwq1ua80dGM72i7rpDNAIIdfcR1WK-hG/view?usp=sharing → Provides
/usr/bin/{gcc49, g++49}.
gcc63-c++-6.3.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1t4WrgvpEP-6_NN3qMJhz9MS3CJhHrHKc/view?usp=sharing → Provides
/usr/bin/{gcc63, g++63}.gcc45-c++-4.5.4-1.el7.x86_64.rpm https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing → Provides
/usr/bin/{gcc45, g++45, gfortran45}gcc42-c++-4.2.4-1.el6.x86_64.rpm https://drive.google.com/file/d/1eYWk6Nd63xeqqAUoJldNWRuwEGO6cAyv/view?usp=sharing → Provides
/usr/bin/{gcc42, g++42}
gcc73-c++-7.3.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1PgwCP5tu8D0EJbJVTqJd7Vg8dJ4l4noi/view?usp=sharing → Provides
/usr/bin/{gcc73, g++73}gcc48-c++-4.8.5-1.el6.x86_64.rpm https://drive.google.com/file/d/1w6fW6oSflDDYZt_cOpGj3QMEmzUC8Q9L/view?usp=sharing → Provides
/usr/bin/{gcc48, g++48, gfortran48}gcc84-c++-8.4.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1xgFtsiDi2uiB1B0AcOaSpxVizzET-pJf/view?usp=sharing → Provides
/usr/bin/{gcc84, g++84, gfortran84}
software installation - gcc is not present in /usr/bin. How to install it in RHEL 7? - Unix & Linux Stack Exchange
How do I install gcc from source on RHEL 7 (WITHOUT A SUBSCRIPTION!)?
How to update GCC from 4.8 to 8.2 on RHEL7 - Stack Overflow
How to install GCC 8 and Clang/LLVM 6 on Red Hat Enterprise Linux 7 - Red Hat Developer Blog
I'm really trying to install a few things but in order to accomplish them I need to first have a C compiler. I am trying to install gcc-8.2.0. This is a sandbox server that is not registered. So no access to the subscription-manager to get all the tools id need to do this easily.
Here is the error message I get when running ./configure:
`` [root@localhost gcc-8.2.0]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libmpx support... yes
checking for libhsail-rt support... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/bdonahue/gcc-8.2.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
``
I have also been looking into somehow installing CentOS yum repositories in this RHEL 7? Haven't come up with much on that either. Thanks for any help in advance!
Red Hat Enterprise Linux, being an "enterprise" operating system, is designed to be stable and similar for a long time. That means you do not get the "latest and greatest" by default, but a known-good implementation that remains the default on that particular RHEL version for the long term. Generally you only get substantial software upgrades by upgrading RHEL. Unfortunately, there is no RHEL 8 yet.
devtoolset allows you to switch to newer, out-of-band versions of development software like GCC, in a way that doesn't "contaminate" the whole OS installation. I used it, with great success, to get GCC 4.8 (and its C++11 support) on CentOS 6, where the official GCC is 4.4.
devtoolset-8 has GCC 8.2.1.
Or you could choose to use a distribution more suited for home users, such as Fedora.
Or you could download the GCC source and build it yourself (but ew!).
One can surely build the gcc on CentOS oneself(though ew!).
Generally follow the below steps:
sudo yum -y update
sudo yum -y install bzip2 wget gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel make
gcc --version
wget http://mirrors-usa.go-parts.com/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz
tar zxf gcc-8.2.0.tar.gz
mkdir gcc-8.2.0-build
cd gcc-8.2.0-build
../gcc-8.2.0/configure --enable-languages=c,c++ --disable-multilib
make -j 2
sudo make install
gcc --version
At this point, many can not see 8.2, i.e.
gcc version 4.8.5 (GCC)
Just overwrite the old gcc with which just built, i.e.
# which gcc
/usr/local/bin/gcc
# cp gcc/xgcc /usr/local/bin/gcc
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-unknown-linux-gnu/7.2.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ../gcc-7.2.0/configure --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 7.2.0 (GCC)
In order to avoid library error, one may need update libstdc as well,
cp ./aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 /usr/local/lib64/libstdc++.so.6
cp ./stage1-aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 /usr/lib64/libstdc++.so.6
One may also update libc.so as well, i.e. 2.18
curl -O http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxf glibc-2.18.tar.gz
cd glibc-2.18/
mkdir build
cd build/
../configure --prefix=/usr
make -j2
make install
ln -sf /usr/glibc-2.18/glibc-2.18.so /lib64/libc.so.6
Finally, type /lib64/libc.so.6 to confirm
Mostly, ln would fail, since old relations, and LD is suggested, i.e.
LD_LIBRARY_PATH=/usr/glibc-2.18/lib
export LD_LIBRARY_PATH