Ubuntu用的人都懒了,从来没有编译过GCC什么的东西,一直有sudo权限,所以即使更新神马的,都很容易搞定。现在开始用自强3000服务器,再也不是sudoers,用编译器啥的真叫个要命。折腾了好几天,好歹是弄上了GCC 4.x的c,,c++编译器,刚好够自己用。
系统版本:
$ head -n 1 /etc/issueRed Hat Enterprise Linux AS release 4 (Nahant Update 6)
GCC版本:
$ gcc -vReading specs from /usr/lib/gcc/x86_64-RedHat-linux/3.4.6/specsConfigured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-java-awt=gtk –host=x86_64-redhat-linuxThread model: posixgcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
—————————————————废话分割线—————————————————
安装编译过程:
1. 编译GCC 4.x前提系统条件:
a. GMP 4.3.2以上 (GNU Multiple Precision Library (GMP))
b. MPFR 2.4.2以上
c. MPC 0.8.1Y以上
d.xz (版本不知道,但是需要这个程序)
e. others… (编译的时候,报错后再看系统还缺什么)
2. 编译环境准备:首先编译GMP,然后编译MPFR,最后编译MPC,安装XZ。
a. 下载GMP: (选用了小日本的服务器,速度还挺快)
b. 解压并安装GMP
$ bzcat gmp* | tar xvf –
$ cd gmp*
$ ./configure –prefix=$HOME/local #安装文件路径,为用户下的local文件夹
$ make -j 8 #多核编译参数-j 数字为核数
$ make install
c. 下载MPFR: (这是至少的版本)
d. 解压并安装MPFR
$ bzcat mpfr* | tar xvf –
$ cd mpfr*
$ ./configure –with-gmp-include=$HOME/local/include –with-gmp-lib=$HOME/local/lib –prefix=$HOME/local #编译MPFR需要有GMP,因此需要指定GMP的位置,不然就白编译了。
$ make -j 8
$ make install
e. 下载MPC:
f. 解压并安装MPC
$ tar xzf mpc*
$ cd mpc*
$ ./configure –prefix=$HOME/local –with-gmp=$HOME/local –with-mpfr=$HOME/local
$ make -j 8
$ make install
销售世界上第一号的产品–不是汽车,而是自己。