Linux安装GCC的一系列问题的解决

我用的是光盘安装gcc的,首先要将光盘挂载,密令依次如下:1.mount /dev/cdrom /mnt/  将dev目录下的cdrom挂载到mnt目录下 2.cd /mnt/Package/ 进入到安装包目录下       3.find -name "gcc*"  可以查看gcc安装包 4.使用rmp ivh 安装包名  ,回车之后就会看到需要安装依赖的库和各类文件。下面就是解决安装依赖包时候解决的问题。

一下这两个东西安装好了才能正常安装gcc安装包的。

RedHat Linux在安装gcc时需要cpp和cloog-ppl
但是在安装cpp的时候需要这个依赖:  libmpfr.so.1()(64bit) is needed by cpp-4.4.6-3.el6.x86_64
安装cloog-ppl的时候需要这2个依赖: libppl.so.7()(64bit) is needed by cloog-ppl-0.15.7-1.2.el6.x86_64

                                                libppl_c.so.2()(64bit) is needed by cloog-ppl-0.15.7-1.2.el6.x86_64

解决方法

确定是一个,因为那时候就是用这个光盘的东西装的系统。
后来解决了,不用yum,只是缺了两个包而已。
之前报这个依赖
        libmpfr.so.1 is needed by cpp-4.4.4-13.el6.i686
        libppl.so.7 is needed by cloog-ppl-0.15.7-1.2.el6.i686
        libppl_c.so.2 is needed by cloog-ppl-0.15.7-1.2.el6.i686

是缺了这两个包……
        mpfr-2.4.1-6.el6.x86_64.rpm
        ppl-0.10.2-11.el6.x86_64.rpm

这两个安装好之后就可以安装cpp和cloog-ppl了,之后就能安装gcc了……

Linux升级GCC 4.8.1清晰简明教程(Ubuntu 12.04 64位版为例) http://www.linuxidc.com/Linux/2014-04/99583.htm

CentOS 6.4中编译安装GCC 4.8.1 + GDB 7.6.1 + Eclipse 在CentOS 6.4中编译安装GCC 4.8.1 + GDB 7.6.1 + Eclipse

Ubuntu下Vim+GCC+GDB安装及使用 http://www.linuxidc.com/Linux/2013-01/78159.htm

Ubuntu下两个GCC版本切换 http://www.linuxidc.com/Linux/2012-10/72284.htm

CentOS6.5升级手动安装GCC4.8.2  http://www.linuxidc.com/Linux/2015-01/112595.htm

GCC 的详细介绍请点这里
GCC 的下载地址请点这里

更多RedHat相关信息见RedHat 专题页面http://www.linuxidc.com/topicnews.aspx?tid=10

本文永久更新链接地址http://www.linuxidc.com/Linux/2015-04/116144.htm

下面开始讲解如何进行依赖包的安装

rpm -ivh cpp-4.1.2-42.el5.i386.rpm

rpm -ihv kernel-headers-2.6.18-92.el5.i386.rpm

rpm -ivh glibc-headers-2.5-24.i386.rpm

rpm -ivh glibc-devel-2.5-24.i386.rpm

rpm -ivh libgomp-4.1.2-42.el5.i386.rpm

rpm -ivh gcc-4.1.2-42.el5.i386.rpm

rpm -ihv libstdc++-devel-4.1.2-42.el5.i386.rpm

rpm -ihv gcc-c++-4.1.2-42.el5.i386.rpm

 

找到对应的包安装即可(版本可能不同)

 

[root@linux Server]# rpm -ivh gcc-4.1.2-48.el5.x86_64.rpm 
warning: gcc-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies: 

        glibc-devel >= 2.2.90-12 is needed by gcc-4.1.2-48.el5.x86_64
        libgomp >= 4.1.2-48.el5 is needed by gcc-4.1.2-48.el5.x86_64
[root@Linux Server]# ls -l glibc-devel-2.5-49.
glibc-devel-2.5-49.i386.rpm    glibc-devel-2.5-49.x86_64.rpm 
[root@Linux Server]# ls -l glibc-devel-2.5-49.
[root@Linux Server]# rpm -ivh glibc-devel-2.5-49.x86_64.rpm 
warning: glibc-devel-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        glibc-headers is needed by glibc-devel-2.5-49.x86_64
        glibc-headers = 2.5-49 is needed by glibc-devel-2.5-49.x86_64
[root@Linux Server]# rpm -ivh glibc-headers-2.5-49.x86_64.rpm
warning: glibc-headers-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        kernel-headers is needed by glibc-headers-2.5-49.x86_64
        kernel-headers >= 2.2.1 is needed by glibc-headers-2.5-49.x86_64
[root@Linux Server]# rpm -ivh kernel-headers-2.6.18-194.el5.x86_64.rpm
warning: kernel-headers-2.6.18-194.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:kernel-headers         ########################################### [100%]
[root@Linux Server]# rpm -ivh glibc-headers-2.5-49.x86_64.rpm
warning: glibc-headers-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:glibc-headers          ########################################### [100%]
[root@Linux Server]# rpm -ivh glibc-devel-2.5-49.x86_64.rpm 
warning: glibc-devel-2.5-49.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:glibc-devel            ########################################### [100%]
[root@Linux Server]#  rpm -ivh gcc-4.1.2-48.el5.x86_64.rpm 
warning: gcc-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        libgomp >= 4.1.2-48.el5 is needed by gcc-4.1.2-48.el5.x86_64
[root@Linux Server]# rpm -ivh libgomp-4.4.0-6.el5.
libgomp-4.4.0-6.el5.i386.rpm    libgomp-4.4.0-6.el5.x86_64.rpm 
[root@Linux Server]# rpm -ivh libgomp-4.4.0-6.el5.x86_64.rpm
warning: libgomp-4.4.0-6.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:libgomp                ########################################### [100%]
[root@Linux Server]# rpm -ivh gcc-4.1.2-48.el5.x86_64.rpm 
warning: gcc-4.1.2-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:gcc                    ########################################### [100%]

到这步就证明安装成功了,在命令窗口输入gcc命令即可操作c程序

C程序编译过程,就如到C程序所在的目录中,输入gcc -o hello hello.c 完成编译过程  然后输入 ./hello运行程序,还有一个如果在编译的时候需要使用linux的库函数加上 -lpthread ,完成全部操作。


阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页