gcc 4.9 for Fedora 27
If you want gcc 4.9 (the GNU Compiler Collection) on the current version of Fedora, which is Fedora 27, there is an easy option for you! You can use the Cool Other Packages Repo, or copr, written by the user davidva. The easiest way to use his gcc49 copr is this:
sudo dnf -y copr enable davidva/gcc49
sudo sed -i -r -e 's/-\$releasever-/-23-/;' /etc/yum.repos.d/_copr_davidva-gcc49.repo
sudo dnf -y install gcc49
There is a weakness in the repo file delivered by the copr, where it uses the $releasever instead of a static number 23 used by the repo. Davidva compiled the package without a specific fedora version number tied to it, so it will install on any version of Fedora, as long as you can get to the rpm package. There is also a weakness with a particular library. It's in the wrong directory, so it cannot be found. You might find an error when trying to compile a project:
/usr/bin/ld: cannot find -lgcc_s
Use these steps to fix it (Weblink 2).
pushd /opt/gcc-4.9.3/lib64/gcc/x86_64-fedoraunited-linux-gnu/4.9.3
sudo cp -p ../lib64/libgcc_s.so.1 .
sudo ln -s libgcc_s.so.1 libgcc_s.so
popd
As the copr page (Weblink 1) indicates, this installation of gcc 4.9 can be present concurrently with the main gcc installation. To use version 4.9, you need to run:
source /usr/bin/gcc49
Which sets a few variables, notably $CC and $CXX to be the specific binaries from this package.
Comments