-
下载gcc-6.5.0
建议先到网站上下载,然后再通过jupyter上传到服务器。
wget https://ftp.gnu.org/gnu/gcc/gcc-6.5.0/gcc-6.5.0.tar.gz
-
解压gcc
tar zxvf gcc-6.5.0.tar.gz cd gcc-6.5.0
-
安装依赖文件
./contrib/download_prerequisites
-
创建编译目录
cd .. mkdir gcc-6.5.0-build cd gcc-6.5.0-build
-
配置并编译
../gcc-6.5.0/configure --disable-checking --enable-languages=c,c++ --disable-multilib --prefix=/home/jovyan/gcc6 --enable-threads=posix make -j32 && make install
-
查看是否安装成功
cd # /home/jovyan/ ./gcc6/bin/gcc -v # 6.5.0
-
设置环境变量
touch bashrc # Edit "bashrc" in jupyter, you can't use vi or vim via Terminal # Add following lines into "bashrc" and save (you can also specify your own gcc path): export PATH="/home/jovyan/gcc6/bin:/home/jovyan/gcc6/lib64:$PATH" export LD_LIBRARY_PATH="/home/jovyan/gcc6/lib:$LD_LIBRARY_PATH" # In Terminal mv bashrc .bashrc source .bashrc # Check if it works gcc -v # 6.5.0