How to Install gcc 5.3 with yum on CentOS 7.2? - gcc

I am using CentOS 7.2
When I use yum groupinstall "Development Tools", gcc version is 4.8.5, like this:
I would like to install gcc 5.3
How to approach this with yum?

Update:
Often people want the most recent version of gcc, and devtoolset is being kept up-to-date, so maybe you want devtoolset-N where N={4,5,6,7...}, check yum for the latest available on your system). Updated the cmds below for N=7.
There is a package for gcc-7.2.1 for devtoolset-7 as an example. First you need to enable the Software Collections, then it's available in devtoolset-7:
sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
which gcc
gcc --version

Update: Installing latest version of gcc 9: (gcc 9.3.0) - released March 12, 2020:
Same method can be applied to gcc 10 (gcc 10.1.0) - released May 7, 2020
Download file: gcc-9.3.0.tar.gz or
gcc-10.1.0.tar.gz
Compile and install:
//required libraries: (some may already have been installed)
dnf install libmpc-devel mpfr-devel gmp-devel
//if dnf install libmpc-devel is not working try:
dnf --enablerepo=PowerTools install libmpc-devel
//install zlib
dnf install zlib-devel*
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make -j 8 <== this may take around an hour or more to finish
(depending on your cpu speed)
make install
Tested under CentOS 7.8.2003 for gcc 9.3 and gcc 10.1
Tested under CentOS 8.1.1911 for gcc 10.1 (may take more time to compile)
Results: gcc/g++ 9.3.0/10.1.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

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;

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.

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

Related

cilk.h: No such file or directory

I compile in Ubuntu 20.04 with gcc 7.5.0 and g++ 7.5.0(supporting cilk plus), but the error says that 'cilk/cilk.h: No such file or directory'the error is shown in the picture
Anybody could help me with the situation? Thanks a lot!
Your compiler still doesn't support cilkplus, just install it via apt-get install:
sudo apt-get install -y libcilkrts5
there you go,
UPDATE: Cilk is not supported with the gcc package on ubuntu 20.04,
to have cilk on ubuntu 20.04 you have to install gcc version < 7 , by the following instruction it's possible to install gcc-6 g++6 on ubuntu 20.04,
sudo vim /etc/apt/sources.list
add "deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe" to file
sudo apt update
sudo apt-get install gcc-6 g++-6 -y
check by gcc -v if you have downgraded correctly the gcc version Then the cilk extension should work.

LinuxBrew does not install latest version of gcc?

When I do g++ --versionon my Linux Ubuntu I get g++ (Home-brew GCC 5.5.0_7) 5.5.0. This was installed via brew install gcc.
As the latest version of gcc is 10.2, why has brew not installed this version?
I had also tried
sudo apt update
sudo apt install build-essential
sudo apt install gcc-9and
gcc --version
but it did not change the version. Any advice?
Also, when I try to run an installation script I get the following error
error: command 'home/linuxbrew/.linuxbrew/bin/g++ failed with exit code 1
but
which gcc
gives
/home/linuxbrew/.linuxbrew/bin/g++
so I am not sure what happened.

how to install devtoolset-8 / GCC 8 on Amazon Linux 2

On an Amazon Linux 2 Docker image, "yum install gcc" installs gcc 7.3.1.
I want to install gcc 8. It seems it normally can be installed as part of "devtoolset-8" (https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/), but the instructions for either CentOS or RHEL seems not working on Amazon Linux.
So the only way to install gcc 8 on Amazon Linux is to install from source?
I also need the devtoolset-8-toolchain, how can that be installed?
Add the scl repo for centos:
sudo yum-config-manager --add-repo http://mirror.centos.org/centos/7/sclo/x86_64/rh/
Install this libgfortran dependency required for devtoolset-8:(source)
sudo yum install -y wget
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libgfortran5-8.3.1-2.1.1.el7.x86_64.rpm
sudo yum install libgfortran5-8.3.1-2.1.1.el7.x86_64.rpm -y
Install devtoolset-8 with nogpgcheck:(it would be much better to install the key for the repo)
sudo yum install -y devtoolset-8 --nogpgcheck
Finally enable the scl for devtoolset-8:
scl enable devtoolset-8 bash
Running this command shows both the gcc 7 and gcc 8 in the path:
which -a gcc
Output from which -a gcc
/opt/rh/devtoolset-8/root/usr/bin/gcc
/usr/bin/gcc

Can't instal some dependencies on windows 8

I'm trying to install TURN server on windows 8, i'm following THIS LINK,
so he mentioned just Follow all steps from above section.
E.g.
Install all dependencies;
LibEvent and TURN modules. and I don't know how to make those commands work on windows 8
First Step: Download & Install Prerequisite for CentOS:
yum install -y make gcc cc gcc-c++ wget
yum install -y openssl-devel libevent libevent-devel mysql-devel mysql-server

Installing Thrift on CentOS: can't find Boost 1.40 or higher

I can't shake this error when trying to install Thrift:
./configure
...
checking for boostlib >= 1.40.0... configure: WARNING: We could not detect the boost libraries (version 1.40 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
I'm using CentOS. As per the Thrift docs on CentOS, I've done
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel
I've tried using --with-boost to no avail.
I've also done:
[]# yum install boost141
Setting up Install Process
Package boost141-1.41.0-2.el5.x86_64 already installed and latest version
Nothing to do
[]# yum install boost141-devel
Setting up Install Process
Package boost141-devel-1.41.0-2.el5.x86_64 already installed and latest version
Package boost141-devel-1.41.0-2.el5.i386 already installed and latest version
Nothing to do
So now I have:
[root#domU-12-31-39-18-3D-20 include]# find / -name boost
/usr/local/bin/boost
/usr/include/boost141/boost
/usr/include/boost
Through various googling, I've found people with this error who say, 'Oh it was gcc-c++, I didn't have that installed,' but as far as I can tell, I have gcc-c++ installed:
[root#domU-12-31-39-18-3D-20 boost]# yum install gcc-c++
rightscale-epel | 951 B 00:00
Setting up Install Process
Package gcc-c++-4.1.2-46.el5_4.2.x86_64 already installed and latest version
Nothing to do
Any advice? Thanks in advance.
This is an old question, but I recently hit the same thing working with a Cent 5.10 machine and building Thrift
Fixup the include files for boost141 and the build will work.
ln -s /usr/include/boost141/boost /usr/include/boost

Resources