Ubuntu 12.04 成功编译安装 GCC 4.8.1

本文提供了一套详细的指南用于在Linux环境下安装GCC 4.8.1,包括必要的依赖库安装、GCC源码下载、ClooG及ISL配置等步骤,并给出了环境变量设置和构建过程的具体指令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

成功的喜悦总是相似的,失败的原因却有千万种,以下照着做未必成功,但起码是某一个成功案例。。。

写惯英文,也挺浅显易懂的。。。

################# Install dependency #########################

sudo apt-get install libgmp-dev

sudo apt-get install libmpfr4 libmpfr-dev
sudo apt-get install libmpc-dev libmpc2
sudo apt-get install g++-multilib
sudo apt-get install libtool
sudo apt-get install m4
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install autoconf

sudo apt-get install git 

sudo apt-get install zip

################# Download GCC ###########################

Download GCC 4.8.1 from http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/ (seems quite promising for speed)

Supposed to be stored to ~/download

################# ClooG & ISL (Git is needed) #################
svn checkout http://llvm.org/svn/llvm-project/polly/trunk /vobs/repo/polly
/vobs/repo/polly/utils/checkout_cloog.sh ~/build/cloog
mkdir ~/build/build_cloog
cd ~/build/build_cloog/
../cloog/configure --prefix=/vobs/gcc
make -j4 
make install

################# Add below config to ~/.bashrc ##############
export LD_LIBRARY_PATH=/vobs/gcc/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/usr/lib32:/usr/lib/x86_64-linux-gnu:/vobs/gcc/lib
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu:/vobs/gcc/include
export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu:/vobs/gcc/include

################# Config & Build GCC 4.8.1 #################
cd ~/build/
tar xjf ~/download/gcc-4.8.1.tar.bz2
mkdir ~/build/build_gcc
cd ~/build/build_gcc

./gcc-4.8.1/configure --prefix=/vobs/gcc

make ( -j4 ( If you are sure that no fail) )

make install

####################### Installation Completed #######################

Libraries have been installed in:
   /vobs/gcc/lib/../lib64
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'


See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值