In Slackware-current we use version 7.1.0 of the gcc compiler suite. These advanced compilers can sometimes be quite a bit more strict about what they accept as valid code. As a consequence, you will regularly run into compilation issues with software. Not just the software made with the scripts on slackbuilds.org, but also some of the software in the Slackware core distribution requires patches in order to get them to compile.
Until now, I have been lucky to find the patches I needed in the repositories of other distributions, or else developers patched their software themselves. But there will be corner cases where solutions and patches are not readily found, or the developers will simply not support gcc 7. Pale Moon is such a piece of software where the developers recommend compiling with gcc 4.x or as a last resort, gcc 5.
Also, the latest gcc compiler suite has dropped their Java compiler, it was no longer developed. So, no more gcc-java package. However if you want to bootstrap the OpenJDK compiler software, you need to start with a Java compiler. The openjdk developers recommend an already built OpenJDK package to compile a new release. But there may still be a case where you have to bootstrap that very first OpenJDK compiler.
So I took the old sources for gcc-5.4.0 which was part of Slackware-current for a while (11 August 2016 to 4 May 2017), and re-worked my gcc-multilib.SlackBuild script:
- I renamed the package to “gcc5” so that it can be installed alongside Slackware’s gcc 7 packages
- The binaries were given a suffix “-5” to make them stand apart from Slackware’s default compilers
- All except the C, C++ and Java language compilers were removed
- Only one all-encompassing package is built by the script
- A profile script was added – you can ‘source’ it to activate the gcc-5 compilers as preferred compilers
The result is a gcc5-5.4.0 package – for Slackware-current, both 32bit and 64bit. Get them at http://www.slackware.com/~alien/slackbuilds/gcc5/ .
The 64bit package is a multilib version, but you can install it without issues on a pure 64bit system. You will just not be able to compile 32bit programs with it.
How to use these compilers?
Simple: in your console or terminal, you ‘source’ the provided profile script, like this (there’s a c-shell compatible script as well):
The command “source” is equivalent to the dot command ” . “. The profile script will (re-)define the common variables that are used by make and other programs to determine which binary to run as the compiler:
export CC=gcc-5 export CPP=cpp-5 export CXX=g++-5 export AR=gcc-ar-5 export NM=gcc-nm-5 export RANLIB=gcc-ranlib-5
So, all you have to do next is run your compile job as usual, in that same console or terminal. Nothing else needs to be done after sourcing the profile script. Your program will be compiled with the binaries provided by the gcc5 package.
I did limited testing:
- With the above instructions, I ran my palemoon.SlackBuild script and it provided a package (whereas the gcc7 compiler in Slackware-current would cause the compilation to fail)
- The provided gcj (GNU Java Compiler) was able to bootstrap the OpenJDK 7 sourcecode into a working binary package, which I could then use to compile OpenJDK 8 on slackware-current (OpenJDK 7 is the last release that can still be bootstrapped with the gcj compiler)
Hope this helps some people!