THe newset GCC release on CentOS 7

General support questions
Post Reply
FranekW
Posts: 36
Joined: 2017/05/11 21:19:21

THe newset GCC release on CentOS 7

Post by FranekW » 2018/06/16 10:39:14

hi

I can see the GCC release on Centos 7 is 4.8.5. I have installed Anaconda3 with Python 3 as Centos only ship Python2 which my company does not use. I can see that Anaconda3 GCC release is 7.2.0. While writing this, the most recent release of GCC is 8.1.0. I was how to proceed to install the fresh GCC on Centos 7.

I usual routine is:

Code: Select all

cd <to GCC folder>
yum install gmp-devel mpfr-devel libmpc-devel
configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc) && make install
But when I look at the config.log:

Code: Select all

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
I can see the binaries are going to be installed into `/usr/` and I am not that sure it is the best idea. How can I proceed to have access to the newset GCC and not break everything in my system? Or is it ok to proceed with default installation?

Thanks

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: THe newset GCC release on CentOS 7

Post by TrevorH » 2018/06/16 11:22:59

There are newer gcc versions available as SCLs. Try yum install centos-release-scl then list devtoolset-\*
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

FranekW
Posts: 36
Joined: 2017/05/11 21:19:21

Re: THe newset GCC release on CentOS 7

Post by FranekW » 2018/06/16 11:48:49

I would be interested in "devtoolset-7-gcc-c++ x86_64 7.3.1-5.4.el7". Is it enough to run: "yum install devtoolset-7"?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: THe newset GCC release on CentOS 7

Post by TrevorH » 2018/06/16 12:04:34

Never used it so don't really know. I suspect that 'devtoolset-7' will be a meta package that pulls in all of the other devtoolset-7 packages. If you only need gcc then you might be better off installing the explicit package names you want as those will just pull in their immediate dependencies not the whole lot...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

FranekW
Posts: 36
Joined: 2017/05/11 21:19:21

Re: THe newset GCC release on CentOS 7

Post by FranekW » 2018/06/16 13:27:50

I am not sure how to proceed. I mean I could do exactly how you suggested but I am not sure.

Considering installing sources, would it be dangerous to install the newest release as root? Would I break anything?

EDIT.
After installing devtoolset, it did not recognised GCC new release. I found an anwer on Stack Overflow. To enable new GCC I typed the following:

Code: Select all

scl enable devtoolset-7 bash
Last edited by FranekW on 2018/06/16 14:07:51, edited 2 times in total.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: THe newset GCC release on CentOS 7

Post by TrevorH » 2018/06/16 13:37:13

We don't support or recommend source builds.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

trisun11
Posts: 22
Joined: 2018/05/24 14:04:15
Location: Minsk

Re: THe newset GCC release on CentOS 7

Post by trisun11 » 2019/02/04 09:10:55

I compiled it from sources to 8.2 version few times but it not works correctly as I noticed. :(
After that i found that topic on the forum and followed by this instructions.

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


ok by this way gcc version is 8.2 but i must do scl enable devtoolset-8 bash after each reboot...else gcc -v indicates 4.8.5

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: THe newset GCC release on CentOS 7

Post by tunk » 2019/02/04 12:03:15

I guess you could put that command in .bashrc and/or .bash_profile.

Mike_Rochefort
Posts: 215
Joined: 2016/03/16 02:34:19

Re: THe newset GCC release on CentOS 7

Post by Mike_Rochefort » 2019/02/04 16:22:22

It's usually best to install the toolkit meta package before selecting individual components, although everything should still work as you have done. If you want to have a toolkit always activated for user use, just add the following to your .bash_profile config:

source /opt/rh/<toolset>/enable

Just be aware of what the devtoolsets actually do when building software (particularly C++ programs). An issue that came up recently (which can give you an idea if you're building tools to interop with other applications): https://groups.google.com/forum/#!topic ... 88SyA1OcDA

Cheers,
Mike
Solution Architect @RedHat | RHCE
Former SysAdmin @BlueSkyStudios and @Pixar
Feature animation and VFX enthusiast
--
Report CentOS Stream 8 bugs: https://da.gd/c8s-bugs
Report CentOS Stream 9 bugs: https://da.gd/c9s-bugs

Post Reply