Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Compile older compiler (gcc 4.9) on Arch Linux

In Arch Linux, you can use the AUR to compile your custom version of GCC (example with gcc 4.9)

[Alternative 1]: using the AUR manually

mkdir -p $HOME/build/
cd $HOME/build/
git clone
cd gcc49
makepkg --syncdeps
sudo pacman --upgrade gcc-4.9.3-1-x86_64.pkg.tar.xz

[Alternative 2]: use one of the available AUR helpers:

example using pacaur (needs to be installed previously)

pacaur -S gcc49

To use the newly installed compiler, you have to set the correct version in the shell you are using:

export CXX=/usr/bin/g++-4.9

Note: this has to be done in each new shell you use. To make it permanent, add the line above to your ~/.bashrc file.

Copy link

synchro-- commented Oct 9, 2016

Thank you!

Copy link

McKenlly commented Oct 18, 2017

Great article

Copy link

ShuyangCao commented Jan 12, 2018

I wonder how long the building will take. I have been building it for over 2 hours.

Copy link

erm3nda commented May 19, 2018

Cool, pacaur saving my day (well, night). Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment