Page 1 of 1

{solved}How To Upgrade GCC?

Posted: 30. May 2017, 11:55
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?

Re: {ASK}How To Upgrade GCC?

Posted: 30. May 2017, 15:55
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.

Re: {ASK}How To Upgrade GCC?

Posted: 30. May 2017, 19:17
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).

Re: {solved}How To Upgrade GCC?

Posted: 31. May 2017, 04:45
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 :)

Re: {solved}How To Upgrade GCC?

Posted: 31. May 2017, 05:21
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.

Re: {solved}How To Upgrade GCC?

Posted: 9. Jun 2017, 08:00
by reedych
You can install multiple toolchains, one system, second in /opt (for example).

Re: {solved}How To Upgrade GCC?

Posted: 10. Jun 2017, 06:58
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.

Re: {solved}How To Upgrade GCC?

Posted: 10. Jun 2017, 08:18
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...