On rental servers and servers managed by the company, sudo authority is not given to your account, and in many cases you cannot freely install applications with apt-get or yum.
That said, the essential applications are installed on the system itself, so there aren't many problems, but there may or may not be fatal problems such as "** gcc version is old **". ・ ・ (Zsh, some Python libraries, etc.)
So, I thought, "** Let's forcibly install the latest version of gcc in the local environment! **", and summarized the results of various investigations.
gcc is a fairly large application (certainly about 4G). Therefore, please be careful about the following
--Free space at the installation destination --Let's decide the disk by considering the capacity --Installation time (make takes a long time) ――It is safe to use tmux or something
The following is the command actually executed. In addition, various sources will be the latest as of April 2019.
#Move to a suitable directory (free)
cd ~/TMP
#DL and decompression of gcc source
wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-8.3.0/gcc-8.3.0.tar.gz
tar -zxvf gcc-8.3.0.tar.gz
#Move to gcc directory
cd gcc-8.3.0
#Put the dependent packages in the gcc directory
# gmp
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2
tar xjf ./gmp-6.1.2.tar.bz2
mv gmp-6.1.2 gmp
# mpfr
wget https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.bz2
tar xjf ./mpfr-4.0.2.tar.bz2
mv mpfr-4.0.2 mpfr
# mpc
wget http://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
tar -zxvf mpc-1.1.0.tar.gz
mv mpc-1.1.0 mpc
#build and install
mkdir build
cd build
#LIBRARY to the directory to configure and make_Keep in PATH
unset LIBRARY_PATH
#Change options as appropriate depending on the environment (in my environment as follows)
../configure --prefix=$HOME/local --enable-languages=c,c++ --disable-multilib
make
makefile
This is OK. If you get an error, it's a good idea to check the configure options first.
Also, don't forget to put the path to the installed directory.
Build GCC 4.8.2 and install it in your home directory
Recommended Posts