{solved}How To Upgrade GCC?

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
ciremai
Posts: 6
Joined: 31. May 2016, 21:40

{solved}How To Upgrade GCC?

Post by ciremai »

Hi, Iam using Salix 14.0 with GCC 4.7.1.
I'd like to use C++14 so I need to upgrade the GCC. How do I do that?
Last edited by ciremai on 31. May 2017, 04:48, edited 3 times in total.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: {ASK}How To Upgrade GCC?

Post by mimosa »

Your best bet may be to install Salix 14.2.

If you really want to keep your existing installation, you could upgrade it, first to 14.1, then 14.2; but this is probably the harder path.

Upgrading the C compiler is not recommended.
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: {ASK}How To Upgrade GCC?

Post by DidierSpaier »

To elaborate on the good advice from mimosa, chances are that if you upgrade gcc, other software won't compile, at least without modification.

That's why in Slackware development cycles, gcc is upgraded relatively early, so to let enough time for testing and provide the needed fixes.

As an example if you look at a Changelog for Slackware current you will see that on Thu May 4 22:14:08 UTC 2017 big changes occurred: gcc, glibc and the kernel were all upgraded. Since then, gcc has been rebuilt and other packages patched to provide the necessary adjustment (and probably there are other to come).
ciremai
Posts: 6
Joined: 31. May 2016, 21:40

Re: {solved}How To Upgrade GCC?

Post by ciremai »

mimosa wrote:Your best bet may be to install Salix 14.2.

If you really want to keep your existing installation, you could upgrade it, first to 14.1, then 14.2; but this is probably the harder path.

Upgrading the C compiler is not recommended.
okay, so upgarding GCC alone is risky.
DidierSpaier wrote:To elaborate on the good advice from mimosa, chances are that if you upgrade gcc, other software won't compile, at least without modification.

That's why in Slackware development cycles, gcc is upgraded relatively early, so to let enough time for testing and provide the needed fixes.

As an example if you look at a Changelog for Slackware current you will see that on Thu May 4 22:14:08 UTC 2017 big changes occurred: gcc, glibc and the kernel were all upgraded. Since then, gcc has been rebuilt and other packages patched to provide the necessary adjustment (and probably there are other to come).
thanks for the explanation :)
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: {solved}How To Upgrade GCC?

Post by mimosa »

To add a little more, if you start upgrading other related parts (such as C libraries) then packages built with them previously may break, and need to be rebuilt. That starts to look like a new Slackware / Salix version - work that has been done for you already by developers, including testing that everything runs smoothly together.
reedych
Posts: 37
Joined: 11. Mar 2017, 05:24

Re: {solved}How To Upgrade GCC?

Post by reedych »

You can install multiple toolchains, one system, second in /opt (for example).
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: {solved}How To Upgrade GCC?

Post by mimosa »

Anyone who knows how to do that probably doesn't need to ask - and it would be more work than an upgrade. Indeed, I imagine you'd still need to build the components yourself using the older kernel, as well as rebuilds of any dependent libraries for software compiled with it. So probably, I wouldn't recommend this.
User avatar
Papasot
Donor
Posts: 247
Joined: 3. May 2015, 18:37
Location: Patras, Greece

Re: {solved}How To Upgrade GCC?

Post by Papasot »

GCC supports multiple versions installed in the same system; it is actually designed to do that. The GCC website gives detailed instructions on how to install a second GCC toolchain, usually in /opt.

You have to download GCC and compile the components you need yourself. I already tried that on Salix 14.1 (in my case, I needed a more recent GCC version because it had better support for Fortran 2008 and C+11 features). I compiled and installed the Fortran, C, and C++ components of GCC 6.3.0 on Salix 14.1 (this implies the compilation of libgomp, which comes with the GCC source bundle). Compilation took more than one hour on a 8-core system using make -j, but it was worth the effort, because the results were more than satisfactory.

You can configure the new version of GCC to use different names for the corresponding compilers installed in /opt (e.g. gcc63, g++63, gfortran63). The main system remains unaffected, still using the original GCC that comes with the distro by default. Whenever you want to use the new versions of the compilers in your own projects, you just tweak your makefiles accordingly.The resulting executables worked on a system without a second version of GCC installed, including the OpenMP capabilities.

I haven't try that with Salix 14.2 and the last version of GCC (7.1.0) yet, because Salix 14.2 comes with GCC 5.3.0 which already supports most of the Fortran 2008 and C+11 features I needed. Nowadays I usually switch to Slackel whenever I need GCC 7.1.0. I'll be surprised if installing GCC 7.1.0 as a second compiler set in Salix 14.2 doesn't work though.

In any case, since you still use Salix 14.0, I'd say it's time to install 14.2...
A pleasant detail in this forum: several people pick a picture of their pet as their avatar. Who am I to do otherwise? ;-)
Post Reply