2024年3月7日发(作者:)

原因:因为安装其他软件,升级gcc相关的软件,造成gcc编译错误,说没有gcc,解决方法,用系统盘重新安装gcc。具体方法如下:

[root@mail /]# rpm -e --nodeps cpp

[root@mail /]# rpm -qa | grep gcc

5

5

5

gcc-c++-5

5

[root@mail /]# rpm -ivh /root/rpm/5.x86_

########################################### [100%]

1:cpp ########################################### [100%]

[root@mail /]# rpm -ivh /root/rpm/5.x86_

########################################### [100%]

1:gcc ########################################### [100%]

[root@mail /]# rpm -qa | grep kernel-headers

5

[root@mail /]# rpm -e --nodeps kernel-headers

[root@mail /]# rpm -qa | grep kernel-headers

[root@mail /]# rpm -ivh /root/rpm/5.x86_

########################################### [100%]

1:kernel-headers ########################################### [100%]

[root@mail /]# rpm -qa | grep glibc-headers

glibc-headers-2.5-42

[root@mail /]# rpm -qa | grep glibc-headers

glibc-headers-2.5-42

[root@mail /]# rpm -e --nodeps glibc-headers

[root@mail /]# rpm -ivh /root/rpm/glibc-headers-2.5-42.x86_

########################################### [100%]

1:glibc-headers ########################################### [100%]

[root@mail /]# rpm -qa | grep glibc-devel

glibc-devel-2.5-42

glibc-devel-2.5-42

[root@mail /]# rpm -e --nodeps glibc-devel

error: "glibc-devel" specifies multiple packages

[root@mail /]# rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n" glibc-devel

glibc-devel-2.5-42 (i386)

glibc-devel-2.5-42 (x86_64)

[root@mail /]# rpm -e --nodeps glibc-devel*

error: package glibc-devel* is not installed

[root@mail /]# rpm -e --nodeps glibc-devel-2.5-42 (i386)

-bash: syntax error near unexpected token `('

[root@mail /]# rpm -e --nodeps glibc-devel-2.5-42 (i386)

error: "glibc-devel-2.5-42" specifies multiple packages

error: package (i386) is not installed

[root@mail /]# rpm -e --allmatches glibc-devel

error: Failed dependencies:

glibc-devel >= 2.2.90-12 is needed by (installed) 5.x86_64

[root@mail /]# rpm -qa | grep gcc

5

5

5

gcc-c++-5

5

5

[root@mail /]# rpm -qa | grep glibc-devel

glibc-devel-2.5-42

glibc-devel-2.5-42

[root@mail /]# rpm -e --allmatches --nodeps glibc-devel

[root@mail /]# rpm -qa | grep glibc-devel

[root@mail /]# rpm -ivh /root/rpm/

error: Failed dependencies:

binutils < 2.15.94.0.2-1 conflicts with glibc-devel-2.5-42.i386

[root@mail /]# rpm -ivh /root/rpm/glibc-devel-2.5-42.x86_

error: Failed dependencies:

binutils < 2.15.94.0.2-1 conflicts with glibc-devel-2.5-42.x86_64

[root@mail /]# rpm -qa | grep binutils

binutils-2.15.92.0.2-13.0.0.0.2

5

[root@mail /]# rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n" binutils

5 (x86_64)

binutils-2.15.92.0.2-13.0.0.0.2 (x86_64)

[root@mail /]# rpm -e --allmatches --nodeps binutils

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

[root@mail /]# rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n" binutils

package binutils is not installed

[root@mail /]# rpm -ivh /root/rpm/5.x86_

########################################### [100%]

1:binutils ########################################### [100%]

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

[root@mail /]# rpm -ivh /root/rpm/glibc-devel-2.5-42.*

########################################### [100%]

1:glibc-devel ########################################### [ 50%]

2:glibc-devel ########################################### [100%]

[root@mail /]# rpm -qa | grep libgomp

5

[root@mail /]# rpm -e --nodeps libgomp

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

[root@mail /]# rpm -qa | grep libgomp

[root@mail /]# rpm -qa | grep libgomp*

[root@mail /]# rpm -qa | grep libstdc++-devel

libstdc++-5

[root@mail /]# rpm -e --nodeps libstdc++-devel

[root@mail /]# rpm -ivh /root/rpm/libstdc++-devel*

error: Failed dependencies:

libstdc++ = 5 is needed by libstdc++-5.i386

libstdc++ = 5 is needed by libstdc++-5.x86_64

[root@mail /]# rpm -qa | grep libstdc++

libstdc++-5

compat-libstdc++-33-3.2.3-61

compat-libstdc++-296-2.96-138

libstdc++-5

compat-libstdc++-33-3.2.3-61

[root@mail /]# rpm -ivh /root/rpm/libstdc++-5.x86_

error: Failed dependencies:

libstdc++ = 5 is needed by libstdc++-5.x86_64

[root@mail /]# rpm -e --nodeps libstdc++

error: "libstdc++" specifies multiple packages

[root@mail /]# rpm -e --nodeps --allmatches libstdc++

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

[root@mail /]# rpm -ivh /root/rpm/libstdc++*

########################################### [100%]

1:libstdc++ ########################################### [ 25%]

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

2:libstdc++ ########################################### [ 50%]

/sbin/ldconfig: libraries .2 and .2.0.0 in directory /usr/lib have same soname but different type.

3:libstdc++-devel ########################################### [ 75%]

4:libstdc++-devel ########################################### [100%]

[root@mail /]# rpm -ivh /root/rpm/compat-libstdc++-

compat-libstdc++- compat-libstdc++-

compat-libstdc++-33-3.2.3-61.x86_

[root@mail /]# rpm -ivh /root/rpm/compat-libstdc++-

compat-libstdc++- compat-libstdc++-

compat-libstdc++-33-3.2.3-61.x86_

[root@mail /]# rpm -ivh /root/rpm/compat-libstdc++-*

########################################### [100%]

package compat-libstdc++-33-3.2.3-61.x86_64 is already installed

package compat-libstdc++-296-2.96-138.i386 is already installed

package compat-libstdc++-33-3.2.3-61.i386 is already installed

[root@mail /]# rpm -ivh /root/rpm/gcc-c++-5.x86_

########################################### [100%]

package gcc-c++-5.x86_64 (which is newer than gcc-c++-5.x86_64) is already

installed

file /usr/bin/c++ from install of gcc-c++-5.x86_64 conflicts with file from package

gcc-c++-5.x86_64

file /usr/bin/g++ from install of gcc-c++-5.x86_64 conflicts with file from package

gcc-c++-5.x86_64

file /usr/bin/x86_64-redhat-linux-c++ from install of gcc-c++-5.x86_64 conflicts with file

from package gcc-c++-5.x86_64

file /usr/bin/x86_64-redhat-linux-g++ from install of gcc-c++-5.x86_64 conflicts with file

from package gcc-c++-5.x86_64

file /usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/libsupc++.a from install of gcc-c++-5.x86_64

conflicts with file from package gcc-c++-5.x86_64

file /usr/lib/gcc/x86_64-redhat-linux/4.1.1/libsupc++.a from install of gcc-c++-5.x86_64

conflicts with file from package gcc-c++-5.x86_64

file /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus from install of gcc-c++-5.x86_64

conflicts with file from package gcc-c++-5.x86_64

file /usr/share/man/man1/g++. from install of gcc-c++-5.x86_64 conflicts with file from

package gcc-c++-5.x86_64