RHEL6.5 升级gcc 4.9.4

1. 准备说明

  • 系统:Rhel 6.4

    [root@localhost ~]# uname -a
    Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

  • gcc升级说明

[root@localhost ~]# gcc -v
使用内建 specs。
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

从4.4.7升级到4.9.4

2. 安装步骤

2.1 下载文件

  1. 下载gcc4.9.4

wget http://mirrors-usa.go-parts.com/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.gz
建议使用下载工具下载

  1. 切换到root用户

su root

  1. 解压下载的gcc放到/usr/local/src目录(假设用户已在/usr/local/src目录下,且gcc压缩文件也在此目录)

tar -xzf gcc-4.9.4.tar.gz
[root@localhost src]# ls
gcc-4.9.4
[root@localhost src]# pwd
/usr/local/src

  1. 进入目录并下载必要文件

[root@localhost src]# cd gcc-4.9.4/
[root@localhost gcc-4.9.4]# ./contrib/download_prerequisites

  1. 创建编译后的程序文件存放目录,并进入

[root@localhost gcc-4.9.4]# mkdir /usr/local/build
[root@localhost gcc-4.9.4]# mkdir /usr/local/build/gcc-4.9.4
[root@localhost gcc-4.9.4]# cd ..
[root@localhost src]# cd /usr/local/build/gcc-4.9.4/

  1. 配置gcc参数

[root@localhost gcc-4.9.4]# /usr/local/src/gcc-4.9.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

  1. 编译

make -j4

  1. 安装

make install

  1. 验证

source /etc/profile
gcc -v

你可能感兴趣的:(RHEL6.5 升级gcc 4.9.4)