一、目的
红旗Linux Asianux4下安装gcc
二、环境
对于红旗linux Asianux_server4_sp2(Linux localhost.localdomain 2.6.32-279.2.1.el6.x86_64 #1 SMP Tue Aug 14 11:42:24 CST 2012 x86_64 x86_64 x86_64 GNU/Linux),应该是基于redhat6 EL版本
三、获取安装gcc需要的rpm文件
通过虚拟机VMware将系统安装iso文件挂载到系统中,进入/media/ASIANUX/Packages/目录,找到如下8个依赖rpm文件。
[root@localhost gcc]# ll
总用量 19216
-rw-r--r-- 1 root root 94324 9月 16 17:11 cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm
-rw-r--r-- 1 root root 3916624 9月 16 17:11 cpp-4.4.6-4.AXS4.x86_64.rpm
-rw-r--r-- 1 root root 10564684 9月 16 17:11 gcc-4.4.6-4.AXS4.x86_64.rpm
-rw-r--r-- 1 root root 992876 9月 16 17:11 glibc-devel-2.12-1.80.AXS4.5.x86_64.rpm
-rw-r--r-- 1 root root 614716 9月 16 17:11 glibc-headers-2.12-1.80.AXS4.5.x86_64.rpm
-rw-r--r-- 1 root root 1989396 9月 16 17:11 kernel-headers-2.6.32-279.2.1.el6.x86_64.rpm
-rw-r--r-- 1 root root 159836 9月 16 17:11 mpfr-2.4.1-6.AXS4.x86_64.rpm
-rw-r--r-- 1 root root 1321268 9月 16 17:11 ppl-0.10.2-11.AXS4.x86_64.rpm
文件依赖关系树型结构图
gcc
kernel-headers-2.6.32-279.2.1.el6.x86_64.rpm
glibc-headers-2.12-1.80.AXS4.5.x86_64.rpm
glibc-devel-2.12-1.80.AXS4.5.x86_64.rpm
gcc-4.4.6-4.AXS4.x86_64.rpm
cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm
mpfr-2.4.1-6.AXS4.x86_64.rpm
ppl-0.10.2-11.AXS4.x86_64.rpm
cpp-4.4.6-4.AXS4.x86_64.rpm
四、安装步骤
1. 安装kernel-headers-2.6.32-279.2.1.el6.x86_64.rpm
[root@localhost gcc]# rpm -ivh kernel-headers-2.6.32-279.2.1.el6.x86_64.rpm
warning: kernel-headers-2.6.32-279.2.1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [100%]
2. 安装glibc-headers-2.12-1.80.AXS4.5.x86_64.rpm
[root@localhost gcc]# rpm -ivh glibc-headers-2.12-1.80.AXS4.5.x86_64.rpm
warning: glibc-headers-2.12-1.80.AXS4.5.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:glibc-headers ########################################### [100%]
3. 安装glibc-devel-2.12-1.80.AXS4.5.x86_64.rpm
[root@localhost gcc]# rpm -ivh glibc-devel-2.12-1.80.AXS4.5.x86_64.rpm
warning: glibc-devel-2.12-1.80.AXS4.5.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
4. 尝试安装gcc-4.4.6-4.AXS4.x86_64.rpm
在尝试安装gcc-4.4.6-4.AXS4.x86_64.rpm时发现在安装它之前必须先安装它的依赖文件cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm和cpp-4.4.6-4.AXS4.x86_64.rpm
[root@localhost gcc]# rpm -ivh gcc-4.4.6-4.AXS4.x86_64.rpm
warning: gcc-4.4.6-4.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
error: Failed dependencies:
cloog-ppl >= 0.15 is needed by gcc-4.4.6-4.AXS4.x86_64
cpp = 4.4.6-4.AXS4 is needed by gcc-4.4.6-4.AXS4.x86_64
5. 尝试安装gcc-4.4.6-4.AXS4.x86_64.rpm的依赖文件之一cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm
在尝试安装cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm时发现在安装它之前必须先安装它的依赖文件mpfr-2.4.1-6.AXS4.x86_64.rpm和ppl-0.10.2-11.AXS4.x86_64.rpm,因为安装这两个rpm文件之后 libppl.so.7()(64bit)和libppl_c.so.2()(64bit)就有了
[root@localhost gcc]# rpm -ivh cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm
warning: cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
error: Failed dependencies:
libppl.so.7()(64bit) is needed by cloog-ppl-0.15.7-1.2.AXS4.x86_64
libppl_c.so.2()(64bit) is needed by cloog-ppl-0.15.7-1.2.AXS4.x86_64
6. 安装cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm的依赖文件mpfr-2.4.1-6.AXS4.x86_64.rpm和ppl-0.10.2-11.AXS4.x86_64.rpm
[root@localhost gcc]# rpm -ivh mpfr-2.4.1-6.AXS4.x86_64.rpm
warning: mpfr-2.4.1-6.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:mpfr ########################################### [100%]
[root@localhost gcc]# rpm -ivh ppl-0.10.2-11.AXS4.x86_64.rpm
warning: ppl-0.10.2-11.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:ppl ########################################### [100%]
7. 在安装了mpfr-2.4.1-6.AXS4.x86_64.rpm和ppl-0.10.2-11.AXS4.x86_64.rpm之后,再返回来安装cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm和cpp-4.4.6-4.AXS4.x86_64.rpm
[root@localhost gcc]# rpm -ivh cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm
warning: cloog-ppl-0.15.7-1.2.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:cloog-ppl ########################################### [100%]
[root@localhost gcc]# rpm -ivh cpp-4.4.6-4.AXS4.x86_64.rpm
warning: cpp-4.4.6-4.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:cpp ########################################### [100%]
8. 最后返回去安装gcc-4.4.6-4.AXS4.x86_64.rpm
[root@localhost gcc]# rpm -ivh gcc-4.4.6-4.AXS4.x86_64.rpm
warning: gcc-4.4.6-4.AXS4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID b941844d: NOKEY
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
9. 检验gcc是否安装成功
[root@localhost gcc]# 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 --enab
le-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 --dis
able-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libg
cj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclips
e-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.6 20120305 (Red Hat 4.4.6-4) (GCC)
ok看到如上信息,说明gcc已经安装成功了。