自己升级gcc 的时候大概参考别人的一份简记 可以大概看看作参考
查看别人安装成功的系统和版本,对应着自己的系统进行安装
https://gcc.gnu.org/gcc-4.8/buildstat.html
下载解压:
$ cd localbuild-gcc-4-8-3
localbuild-gcc-4-8-3$ tar -jxf gcc-4.8.3.tar.bz2
localbuild-gcc-4-8-3$ tar -jxf binutils-2.24.tar.bz2
localbuild-gcc-4-8-3$ tar -jxf gmp-5.1.3.tar.bz2
localbuild-gcc-4-8-3$ tar -jxf mpfr-3.1.2.tar.bz2
localbuild-gcc-4-8-3$ tar -jxf mpc-1.0.1.tar.bz2
localbuild-gcc-4-8-3$ tar -jxf isl-0.12.2.tar.bz2
localbuild-gcc-4-8-3$ tar -xzf cloog-0.18.1.tar.gz
建立软连接
localbuild-gcc-4-8-3$ mkdir combined && cd combined
#Create symlinks to the gcc source tree - Files in the gcc tree are master copy.
#So, maintain the following order without fail.
localbuild-gcc-4-8-3/combined$ ln -s ../gcc-4.8.3/* .
#Create symlinks to the binutils source tree. Ignore several complaints from ln about existing links
localbuild-gcc-4-8-3/combined$ ln -s ../binutils-2.24/* .
#Create symlinks to GMP,MPFR,MPC,ISL,CLOOG source trees without version numbers in links
localbuild-gcc-4-8-3/combined$ ln -s ../gmp-5.1.3 gmp
localbuild-gcc-4-8-3/combined$ ln -s ../mpfr-3.1.2 mpfr
localbuild-gcc-4-8-3/combined$ ln -s ../mpc-1.0.1 mpc
localbuild-gcc-4-8-3/combined$ ln -s ../isl-0.12.2 isl
localbuild-gcc-4-8-3/combined$ ln -s ../cloog-0.18.1 cloog
congifure编译
localbuild-gcc-4-8-3/combined$ cd ..
localbuild-gcc-4-8-3$ mkdir build && cd build
#Export build environment variables. For native build, host=build=target
#To know host info, use config.guess script
localbuild-gcc-4-8-3/build$ ../combined/config.guess
i686-pc-linux-gnu
localbuild-gcc-4-8-3/build$ export host=i686-pc-linux-gnu
localbuild-gcc-4-8-3/build$ export build=$host
localbuild-gcc-4-8-3/build$ export target=$host
localbuild-gcc-4-8-3/build$ export prefix=/usr/local/gcc-4-8-3
#Configure - Enabling 'C','C++' languages
#Configuring combined-tree - Since it includes binutils, --enable-shared NOT to be used. Build fails in stage2 if this option is used. You have been warned.
localbuild-gcc-4-8-3/build$ ../combined/configure --host=$host --build=$build --target=$target --prefix=/usr/local/gcc-4-8-3 --disable-nls --disable-werror --disable-multilib --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix --enable-checking=release --enable-libstdcxx-time --enable-languages=c,c++
#Parallel Build
localbuild-gcc-4-8-3/build$ make -j4
安装
#Install the toolchain
localbuild-gcc-4-8-3/build$ make install
参考文章:
http://www.linuxidc.com/Linux/2014-04/99583p2.htm 非常好的国内文章
https://raghunathlolur.wordpress.com/2014/06/30/combined-tree-build-of-gcc-binutils-and-libraries/ 非常好的一篇文章
http://my.oschina.net/vaero/blog?disp=2&p=1&catalog=375415 不错