Last active
January 14, 2025 22:23
-
-
Save salehjg/6b21f3701b0090ed9b0f50e3166f57eb to your computer and use it in GitHub Desktop.
Building GCC from source.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if an argument was provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <install dir>" | |
exit 1 | |
fi | |
# Assign the first argument to a variable | |
installdir="$1" | |
sudo apt-get update && sudo apt-get install -y \ | |
build-essential \ | |
libgmp-dev \ | |
libmpfr-dev \ | |
libmpc-dev \ | |
libisl-dev \ | |
zlib1g-dev \ | |
flex \ | |
bison \ | |
texinfo \ | |
gawk \ | |
libgccjit-12-dev \ | |
libstdc++-12-dev \ | |
python3 \ | |
libtool \ | |
binutils-dev | |
git clone git://gcc.gnu.org/git/gcc.git | |
cd gcc | |
git checkout refs/tags/releases/gcc-14.2.0 | |
make distclean # cleaning up just in case, might fail | |
./configure --disable-multilib --prefix=${installdir} | |
make -j | |
make install | |
echo "Finished, check the install directory: ${installdir}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment