Skip to content

Instantly share code, notes, and snippets.

@crazytaxii
Last active May 17, 2021 15:08
Show Gist options
  • Save crazytaxii/1b31691d7de2eadb21221f24e49c567c to your computer and use it in GitHub Desktop.
Save crazytaxii/1b31691d7de2eadb21221f24e49c567c to your computer and use it in GitHub Desktop.
Compile and install gcc 4.9.0 from source

Install gcc from source

Download gcc source code from https://ftp.gnu.org/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.gz

$ wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.gz

Install dependencies

$ yum install gmp-devel mpfr-devel libmpc-devel -y

Build from source and install

$ tar -xvzf gcc-4.9.0.tar.gz
$ cd gcc-4.9.0
$ mkdir build && cd build
$ ../configure --prefix=/usr --enable-languages=c,c++ --disable-multilib
$ make -j$(nproc)
$ make install

Validate installation

$ gcc --version
gcc (GCC) 4.9.0
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment