Skip to content

Instantly share code, notes, and snippets.

@tyleransom
Forked from jdhao/gcc-5.4.0-install.sh
Last active January 11, 2024 05:47
Show Gist options
  • Save tyleransom/2c96f53a828831567218eeb7edc2b1e7 to your computer and use it in GitHub Desktop.
Save tyleransom/2c96f53a828831567218eeb7edc2b1e7 to your computer and use it in GitHub Desktop.
The script will install GCC 5.4.0 on your CentOS 7 system, make sure you have root right.
echo "Downloading gcc source files..."
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
echo "extracting files..."
tar xvfj gcc-5.4.0.tar.bz2
echo "Installing dependencies..."
yum install gmp-devel mpfr-devel libmpc-devel
echo "Configure and install..."
mkdir gcc-5.4.0-build
cd gcc-5.4.0-build
../gcc-5.4.0/configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc) && make install # note: nproc is the number of threads (e.g. 4 or 8)
# Also note: https://stackoverflow.com/questions/36327805/how-to-install-gcc-5-3-with-yum-on-centos-7-2 has a good discussion of how to get newer versions of gcc
# http://www.admin-magazine.com/HPC/Articles/Environment-Modules is a good place for learning about how to set up environment modules
@mrprajesh
Copy link

To install dependencies we could do the following

../gcc-5.4.0/contrib/download_prerequisites

in case we do not have sudo access.

@tyleransom
Copy link
Author

๐Ÿ‘

@joneswong
Copy link

It works in my case. thanks!

@tyleransom
Copy link
Author

๐Ÿ‘

@zjwzcx
Copy link

zjwzcx commented Feb 28, 2023

Thanks!

@tyleransom
Copy link
Author

๐Ÿ‘

@behnambabazadeh
Copy link

๐Ÿ‘Œ

@tyleransom
Copy link
Author

๐Ÿ‘

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