本身升級gcc 的時候大概參考別人的一份簡記 能夠大概看看做參考 html
查看別人安裝成功的系統和版本,對應着本身的系統進行安裝 linux
https://gcc.gnu.org/gcc-4.8/buildstat.html
下載解壓: c++
$ 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 cloogcongifure編譯
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
參考文章: shell
http://www.linuxidc.com/Linux/2014-04/99583p2.htm 很是好的國內文章 wordpress
https://raghunathlolur.wordpress.com/2014/06/30/combined-tree-build-of-gcc-binutils-and-libraries/ 很是好的一篇文章 ui
http://my.oschina.net/vaero/blog?disp=2&p=1&catalog=375415 不錯 this