在一Linux服务器上检查是否安装了一些包时,遇到老是提示"package compat-libstdc++ is not installed"
[root@DB-Server ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
> compat-libstdc++ \
> elfutils-libelf \
> elfutils-libelf-devel \
> gcc \
> gcc-c++ \
> glibc \
> glibc-common \
> glibc-devel \
> glibc-headers \
> ksh \
> libaio \
> libaio \
> libaio-devel \
> libgcc \
> libstdc++ \
> libstdc++-devel \
> make \
> sysstat
binutils-2.17.50.0.6-14.el5 (x86_64)
package compat-libstdc++ is not installed
elfutils-libelf-0.137-3.el5 (x86_64)
elfutils-libelf-0.137-3.el5 (i386)
elfutils-libelf-devel-0.137-3.el5 (x86_64)
gcc-4.1.2-51.el5 (x86_64)
gcc-c++-4.1.2-51.el5 (x86_64)
glibc-2.5-65 (x86_64)
glibc-2.5-65 (i686)
glibc-common-2.5-65 (x86_64)
glibc-devel-2.5-65 (x86_64)
glibc-devel-2.5-65 (i386)
glibc-headers-2.5-65 (x86_64)
ksh-20100202-1.el5_6.6 (x86_64)
libaio-0.3.106-5 (x86_64)
libaio-0.3.106-5 (i386)
libaio-0.3.106-5 (x86_64)
libaio-0.3.106-5 (i386)
libaio-devel-0.3.106-5 (x86_64)
libaio-devel-0.3.106-5 (i386)
libgcc-4.1.2-51.el5 (x86_64)
libgcc-4.1.2-51.el5 (i386)
libstdc++-4.1.2-51.el5 (x86_64)
libstdc++-4.1.2-51.el5 (i386)
libstdc++-devel-4.1.2-51.el5 (x86_64)
make-3.81-3.el5 (x86_64)
sysstat-7.0.2-11.el5 (x86_64)
[root@DB-Server ~]#
[root@DB-Server ~]# rpm -qa | grep "compat-libstdc"
compat-libstdc++-33-3.2.3-61
compat-libstdc++-33-3.2.3-61
compat-libstdc++-296-2.96-138
[root@DB-Server ~]#
但是使用上面命令发现这个这些包其实是已经安装了的,那么为什么老是提示compat-libstdc++没有安装呢?这个是因为使用rpm查询时,包名不正确所致。它真正的报名为 compat-libstdc++-33 而不是compat-libstdc++ 。如果包名正确,那么查询结果就会不一样,如下所示:
[root@DB-Server ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' compat-libstdc++-33
compat-libstdc++-33-3.2.3-61 (x86_64)
compat-libstdc++-33-3.2.3-61 (i386)