简体   繁体   English

检查rpm包中已使用库的版本

[英]Check the version of used libraries in an rpm package

I installed qpid on RHEL 7, and wanted to know if it's picking up the right version of boost. 我在RHEL 7上安装了qpid,并且想知道它是否正在使用正确版本的boost。 How do you use rpm command to check if it's using the right set of libs. 如何使用rpm命令检查它是否正在使用正确的lib集。 It doesn't have to be rpm command , i just would like to know if using the right version of boost. 它不一定是rpm命令,我只想知道是否使用正确版本的boost。

You could use rpm -qa to check the installed RPMs, and examine the results. 您可以使用rpm -qa检查已安装的RPM,并检查结果。 Eg, from my machine (Fedora 23, but the same principal should work for RHELs): 例如,从我的机器(Fedora 23,但相同的主体应该适用于RHEL):

mureinik@computer ~$ rpm -qa | grep boost
ibus-typing-booster-1.4.5-1.fc23.noarch
boost-thread-1.58.0-11.fc23.x86_64
boost-date-time-1.58.0-11.fc23.x86_64
boost-iostreams-1.58.0-11.fc23.x86_64
boost-system-1.58.0-11.fc23.x86_64

Maybe this will help. 也许这会有所帮助。

rpm -qa will list all the installed programs. rpm -qa将列出所有已安装的程序。

If you know the boost version you should be using, then you can use rpm -qa | grep <program_name> 如果你知道你应该使用的升级版本,那么你可以使用rpm -qa | grep <program_name> rpm -qa | grep <program_name> . rpm -qa | grep <program_name>

rpm -qi <package_name> can give you more specific information about the package version. rpm -qi <package_name>可以为您提供有关软件包版本的更多具体信息。 The -qi flag gives you version, release, install date, size, etc. -qi标志为您提供版本,发布,安装日期,大小等。

This is not usually a problem you need to deal with for software installed via RPMs, as long as you avoid overriding rpm / yum / dnf 's dependency checking. 对于通过RPM安装的软件,这通常不是一个问题,只要您避免覆盖rpm / yum / dnf的依赖性检查。 The RPM will specify library dependencies down to library SONAME, and package installation / upgrade / removal verifies that those library dependencies are satisfied and remain satisfied. RPM将指定库依赖关系到库SONAME,并且包安装/升级/删除验证是否满足这些库依赖关系并保持满意。

However, in the event that you have bad packages somewhere in the mix, or if you install any unpackaged software, or if you use --force to override dependency checks, then it's possible to have library issues with rpm-packaged software, not to mention other software. 但是,如果您在混合中的某个地方有错误的软件包,或者您安装了任何未打包的软件,或者您使用--force来覆盖依赖性检查,那么可能会出现rpm包装软件的库问题,而不是提到其他软件。 There could be multiple libraries installed with the same SONAME, and the dynamic linker could choose a different one of them than you want it to do. 可能有多个库使用相同的SONAME安装,动态链接器可以选择不同的库,而不是您想要的。 Or you might have unsatisfied library dependencies. 或者您可能有不满意的库依赖项。

You may therefore want to determine exactly which libraries will be dynamically linked to a given executable, independent of packaging. 因此,您可能希望确定哪些库将动态链接到给定的可执行文件,而与包装无关。 You can do this via the ldd command. 您可以通过ldd命令执行此操作。 For example, on my CentOS 6 system: 例如,在我的CentOS 6系统上:

$ ldd /bin/rpm
    linux-vdso.so.1 =>  (0x00007ffdabd77000)
    librpmbuild.so.1 => /usr/lib64/librpmbuild.so.1 (0x0000003708600000)
    librpm.so.1 => /usr/lib64/librpm.so.1 (0x0000003709200000)
    libmagic.so.1 => /usr/lib64/libmagic.so.1 (0x0000003707a00000)
    librpmio.so.1 => /usr/lib64/librpmio.so.1 (0x0000003709600000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003707e00000)

[...] [...]

    libnspr4.so => /lib64/libnspr4.so (0x0000003716200000)

This is also useful for detecting library dependencies that are not satisfied at all; 这对于检测完全不满足的库依赖性也很有用; again, this is rarely a problem with RPM-packaged software, but I run into it from time to time with pre-built software distributed in other kinds of packaging. 再一次,这对于RPM打包的软件来说很少是一个问题,但我不时会遇到其他类型的包装中预先构建的软件。

For a given package, you can use rpm -qR to show its dependencies, and then for each dependency, rpm -q --whatprovides to show the actual package names. 对于给定的包,您可以使用rpm -qR来显示其依赖项,然后对于每个依赖项, rpm -q --whatprovides以显示实际的包名称。 I do this in my build-logs, to keep track of what I built, using a script to format the listing from rpm for readability. 我在构建日志中执行此操作,以跟踪我构建的内容,使用脚本从rpm格式化列表以提高可读性。

For example, given an installed "ncurses6", and the script starts by doing this: 例如,给定已安装的“ncurses6”,脚本首先执行此操作:

rpm -qR ncurses6

I get output like this: 我得到这样的输出:

/bin/sh
/usr/bin/pkg-config
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libformw6.so.6()(64bit)
libformw6.so.6(NCURSESW6_5.1.20000708)(64bit)
libgcc_s.so.1()(64bit)
libgcc_s.so.1(GCC_3.0)(64bit)
libm.so.6()(64bit)
libmenuw6.so.6()(64bit)
libmenuw6.so.6(NCURSESW6_5.1.20000708)(64bit)
libncurses++w6.so.6()(64bit)
libncursesw6.so.6()(64bit)
libncursesw6.so.6(NCURSESW6_5.1.20000708)(64bit)
libncursesw6.so.6(NCURSESW6_5.3.20021019)(64bit)
libncursesw6.so.6(NCURSESW6_5.4.20040208)(64bit)
libncursesw6.so.6(NCURSESW6_5.5.20051010)(64bit)
libncursesw6.so.6(NCURSESW6_5.6.20061217)(64bit)
libncursesw6.so.6(NCURSESW6_5.7.20081102)(64bit)

and my script produces a report like this: 我的脚本生成一个这样的报告:

** package/ncurses.spec
** ncurses6
package bash-4.3.42-3.fc23.x86_64
        /bin/sh
package glibc-2.22-16.fc23.x86_64
        libc.so.6()(64bit)
        libc.so.6(GLIBC_2.14)(64bit)
        libc.so.6(GLIBC_2.2.5)(64bit)
        libc.so.6(GLIBC_2.3)(64bit)
        libc.so.6(GLIBC_2.3.4)(64bit)
        libc.so.6(GLIBC_2.4)(64bit)
        libm.so.6()(64bit)
        libutil.so.1()(64bit)
        rtld(GNU_HASH)
package libgcc-5.3.1-6.fc23.x86_64
        libgcc_s.so.1()(64bit)
        libgcc_s.so.1(GCC_3.0)(64bit)
package libstdc++-5.3.1-6.fc23.x86_64
        libstdc++.so.6()(64bit)
        libstdc++.so.6(CXXABI_1.3)(64bit)
        libstdc++.so.6(GLIBCXX_3.4)(64bit)
package ncurses6-6.0-20160528.x86_64
        libformw6.so.6()(64bit)
        libformw6.so.6(NCURSESW6_5.1.20000708)(64bit)
        libmenuw6.so.6()(64bit)
        libmenuw6.so.6(NCURSESW6_5.1.20000708)(64bit)
        libncurses++w6.so.6()(64bit)
        libncursesw6.so.6()(64bit)
        libncursesw6.so.6(NCURSESW6_5.1.20000708)(64bit)
        libncursesw6.so.6(NCURSESW6_5.3.20021019)(64bit)
        libncursesw6.so.6(NCURSESW6_5.4.20040208)(64bit)
        libncursesw6.so.6(NCURSESW6_5.5.20051010)(64bit)
        libncursesw6.so.6(NCURSESW6_5.6.20061217)(64bit)
        libncursesw6.so.6(NCURSESW6_5.7.20081102)(64bit)
        libncursesw6.so.6(NCURSESW6_5.8.20110226)(64bit)

(the script is 200 lines of Perl, counting comments and whitespace: a good student exercise). (该脚本是200行Perl,计算注释和空白:一个很好的学生练习)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM