Cygwin 中Gcc的升级 4.6.3

          (把相关的组建均选择最新版本即可,)
    Cygwin 是个好东西,这个不用我多说了。话不多说,言归正传,
我的cygwing里的gcc的version是3.4.4,现在最新的是4.6.3,所以我就想升级了。
好了,看看我是怎么做的吧:

打开 cygwin

一、首先检查一下必备的工具包。用以下命令来检查,如果没有就给他装上。
代码
  1. cygcheck -c bash binutils bzip2 gcc-core gcc-java  gzip m4 make unzip zip patch patchutils diffutils cygutils nasm subversion autoconf automake perl wget make libbz2-devel zip unzip python 
cygcheck -c bash binutils bzip2 gcc-core gcc-java  gzip m4 make unzip zip patch patchutils diffutils cygutils nasm subversion autoconf automake perl wget make libbz2-devel zip unzip python

这条命令很长,很多懒人不愿意自己输入,所以,你可以 Ctrl + c and Ctrl +v 。其实这里的Ctrl+v是不好用的。右键点击cygwin的最上边,==》编辑==》粘贴 就ok了。如果出现下面的内容就可以继续了
代码
  1. Package              Version        Status 
  2. autoconf             3.3-1          OK 
  3. automake             2-1            OK 
  4. bash                 3.1-9          OK 
  5. binutils             20060817-1     OK 
  6. bzip2                1.0.3-1        OK 
  7. cygutils             1.3.0-1        OK 
  8. diffutils            2.8.7-1        OK 
  9. gcc-core             3.4.4-1        OK 
  10. gcc-java             3.4.4-1        OK 
  11. gzip                 1.3.5-2        OK 
  12. m4                   1.4.7-1        OK 
  13. make                 3.81-1         OK 
  14. nasm                 0.98.39-1      OK 
  15. patch                2.5.8-8        OK 
  16. patchutils           0.2.31-1       OK 
  17. perl                 5.8.7-5        OK 
  18. python               2.4.3-1        OK 
  19. subversion           1.3.2-1        OK 
  20. unzip                5.52-2         OK 
  21. wget                 1.10.2-1       OK 
  22. zip                  2.32-2         OK 
Package              Version        Status
autoconf             3.3-1          OK
automake             2-1            OK
bash                 3.1-9          OK
binutils             20060817-1     OK
bzip2                1.0.3-1        OK
cygutils             1.3.0-1        OK
diffutils            2.8.7-1        OK
gcc-core             3.4.4-1        OK
gcc-java             3.4.4-1        OK
gzip                 1.3.5-2        OK
m4                   1.4.7-1        OK
make                 3.81-1         OK
nasm                 0.98.39-1      OK
patch                2.5.8-8        OK
patchutils           0.2.31-1       OK
perl                 5.8.7-5        OK
python               2.4.3-1        OK
subversion           1.3.2-1        OK
unzip                5.52-2         OK
wget                 1.10.2-1       OK
zip                  2.32-2         OK



二、分别从网站下载安装包
yasm :http://www.tortall.net/projects/yasm/releases/yasm-0.8.0.tar.gz
gmp :http://ftp.gnu.org/gnu/gmp/gmp-4.3.1.tar.gz
mpfr: http://www.mpfr.org/mpfr-current/mpfr-2.4.1.tar.gz
然后解压的一个目录里,我是解压到了 /~目录中了。
接着我们就要编译这三个包文件
代码
  1. cd yasm-0.8.0 && ./configure && make && make install && cd .. && cd gmp-4.3.1 && ./configure && make -j 2 && make install && cd .. && cd mpfr-2.4.1 && ./configure && make -j2 && make install && cd ..  
cd yasm-0.8.0 && ./configure && make && make install && cd .. && cd gmp-4.3.1 && ./configure && make -j 2 && make install && cd .. && cd mpfr-2.4.1 && ./configure && make -j 2 && make install && cd .. 


要等好一会的waiting...

为了确保yasm安装正确可以测试一下:
代码
  1. yasm --version 
yasm --version

如果看到的是  yasm 0.8.0.2194  就说明 一切ok了。
重启cygwin。

三、从网站:ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.4.2/gcc-4.4.2.tar.gz 下载gcc的源码
把源码解压到 刚才的~目录,用以下的命令来编译安装:
代码
  1. cd gcc-4.4.2 && ./configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --disable-java-awt --with-system-zlib --disable-libgcj-debug --enable-threads=posix --disable-win32-registry --enable-sjlj-exceptions && make -j 2 && make install 
cd gcc-4.4.2 && ./configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --disable-java-awt --with-system-zlib --disable-libgcj-debug --enable-threads=posix --disable-win32-registry --enable-sjlj-exceptions && make -j 2 && make install

PS:有朋友说实施了却没有成功。说是“--with-gmp and/or --with-mpfr options”的问题,如果你也出现了同样的问题,可以将上面的命令换为
代码
  1. cd gcc-4.4.2 &&  ./configure --with-gmp-lib=/usr/local/lib --with-gmp=include=/usr/local/include && make -j2 && make install 
d gcc-4.4.2 &&  ./configure --with-gmp-lib=/usr/local/lib --with-gmp=include=/usr/local/include && make -j 2 && make install

这样就行了
赫赫,等吧。。。
完成以后用一下命令来检查达到目的没有。
代码
  1. gcc -v 
gcc -v

gcc version 4.4.2
看看吧。。
升级成功!
就到这里吧。

以上的命令也可以用shell 调用。赫赫。。。
结果:


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值