Created
January 28, 2019 18:53
-
-
Save gzxultra/d2789adff1354b9d08cba9c2e74c1ada to your computer and use it in GitHub Desktop.
script to upgrade gcc on a linux server
This file contains hidden or 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 -l | |
# download gcc source code | |
cd $HOME | |
wget http://mirrors.concertpass.com/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz | |
tar -xzf gcc-8.2.0.tar.gz | |
cd gcc-8.2.0/ | |
./contrib/download_prerequisites | |
# config makefile | |
cd .. | |
mkdir objdir | |
cd objdir | |
$PWD/../gcc-8.2.0/configure --prefix=$HOME/GCC-8.2.0 --enable-languages=c,c++,fortran,go --disable-multilib | |
# build from source code, gonna take about 8 hours | |
make | |
make install | |
# soft-replace system compiler | |
echo 'export PATH="$HOME/GCC-8.2.0/bin:$PATH" ' >> ~/.bashrc | |
echo 'export LD_LIBRARY_PATH="$HOME/GCC-8.2.0/lib:$HOME/GCC-8.2.0/lib64:$LD_LIBRARY_PATH" ' >> ~/.bashrc | |
echo 'export CPATH="$HOME/GCC-8.2.0/include:$CPATH" ' >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment