Skip to content

Instantly share code, notes, and snippets.

@craigminihan
Last active September 21, 2023 12:47
Show Gist options
  • Save craigminihan/b23c06afd9073ec32e0c to your computer and use it in GitHub Desktop.
Save craigminihan/b23c06afd9073ec32e0c to your computer and use it in GitHub Desktop.
Build GCC 4.9.2 for C/C++ on CentOS 7
sudo yum install libmpc-devel mpfr-devel gmp-devel
cd ~/Downloads
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2 -O
tar xvfj gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install
@leungi
Copy link

leungi commented Dec 8, 2019

Thanks, but I didn't understand the instruction. My gcc already is the new one, it's the g++ that's the problem.

My bad.

What I meant was to check the different versions of g++/gcc that you have and create a symbolic link to the desired g++/gcc.

@quocnhat
Copy link

So how to uninstall gcc built by this method? Thank you

@DIMASIK1502
Copy link

Душевно

@zoncpp
Copy link

zoncpp commented Aug 22, 2021

Hi
maybe you need to run :
./contrib/download_prerequisites
before running "./configure ... " command

@edwincoronado
Copy link

I used make -j$(nproc) and it went much faster too.

@wellingtonf-souza
Copy link

wellingtonf-souza commented Mar 28, 2022

The command sequence below worked on my computer to update to version 7:
sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-7
scl enable devtoolset-7 bash
gcc --version

@abdeljalil09
Copy link

abdeljalil09 commented Aug 9, 2022

The command sequence below worked on my computer to update to version 7: sudo yum -y install centos-release-scl sudo yum -y install devtoolset-7 scl enable devtoolset-7 bash gcc --version

this actually fixed an issue i had with node-canvas

npx node-pre-gyp rebuild -C ./node_modules/canvas

gcc version 4.8.5 was not working

@DevinXian
Copy link

Tremendous!

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