简体   繁体   English

CentOS rpm package 依赖于它使用 cmake 构建的 lib“soname”

[英]CentOS rpm package depends on lib "soname" which it builds using cmake

I am trying to build a rpm package using cmake.我正在尝试使用 cmake 构建 rpm package。 This package builds a library and packages it well all is hunky-dory这个 package 构建了一个库并将其打包好

In the next iteration, I add "soname" using the following commands在下一次迭代中,我使用以下命令添加“soname”

set_property(TARGET ${MY_TARGET} PROPERTY VERSION "${SO_VERSION_STRING}")
set_property(TARGET ${MY_TARGET} PROPERTY SOVERSION "${MAJOR_STRING}")

I install (before packaging in to rpm we need to install) it using the following:我使用以下命令安装(在打包到 rpm 之前,我们需要安装)它:

install ( DIRECTORY <PATH_WHERE_LIBS_ARE> DESTINATION <PATH_WHERE_IT_NEEDS_TO_RESIDE>  FILES_MATCHING PATTERN "libABC.so*" )

When the rpm compiles on Ubuntu it does not shows any dependency当 rpm 在 Ubuntu 上编译时,它不显示任何依赖关系

 rpm -qpR my-package-x.yy.zz.pppp.x86_64.rpm
 /bin/sh
 /bin/sh
 rpmlib(CompressedFileNames) <= 3.0.4-1
 rpmlib(FileDigests) <= 4.6.0-1
 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
 

When it compiles on CentOS it addeds a dependency:当它在 CentOS 上编译时,它添加了一个依赖项:

 rpm -qpR my-package-x.yy.zz.pppp.x86_64.rpm
 /bin/sh
 /bin/sh
 /bin/sh
 /bin/sh
 /bin/sh
 /bin/sh
 libABC.so.1()(64bit)
 rpmlib(CompressedFileNames) <= 3.0.4-1
 rpmlib(FileDigests) <= 4.6.0-1
 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
 rpmlib(PayloadIsXz) <= 5.2-1     

The question is why is libABC.so.1()(64bit) , is being added a dependency by CentOS?问题是为什么libABC.so.1()(64bit)被 CentOS 添加了依赖项?

Also, why there is this problem happening only with the "sonames".另外,为什么只有“sonames”才会出现这个问题。 There is no problem when soname is not added / packaged.不添加/打包soname时没有问题。

I tried to do lot of search / investigation but could not come up with the exact cause.我尝试进行大量搜索/调查,但无法找到确切原因。 This problem:这个问题:

"Missing" lib for rpm install when it is present in rpm file 当 rpm 文件中存在 rpm 安装时“缺少”lib

Describes the same problem as mine without using cmake (using plain spec files for rpm) but no solution.在不使用 cmake 的情况下描述了与我相同的问题(使用普通规范文件作为 rpm),但没有解决方案。 I tried to checked if there is some issue with architecture (x32, x64 ) as discussed there but, it seems all fine.我试图检查那里讨论的架构(x32,x64)是否存在问题,但似乎一切都很好。

When RPM builds packages, it automatically scans all the installed files and creates a list of things (eg, executables, libraries) that are provided by the package, as well as dependencies needed (eg, shared libraries, system features).当 RPM 构建软件包时,它会自动扫描所有已安装的文件并创建 package 提供的事物列表(例如,可执行文件、库)以及所需的依赖项(例如,共享库、系统功能)。

The idea is that tools (like rpmbuild) can identify at least some of the program dependencies automatically, so they should automatically add them as the package dependencies.这个想法是工具(如 rpmbuild)可以自动识别至少一些程序依赖项,因此它们应该自动将它们添加为 package 依赖项。

Libraries are a bit funny, because they are treated as both dependencies and a feature provided by the RPM package.库有点有趣,因为它们被视为依赖项和 RPM package 提供的功能。

AFAIK, a so-version enables this feature specifically because that signals to the RPM's dependency finder that this is a well-formed library that others might want to consume. AFAIK,一个 so-version 启用了这个特性,因为它向 RPM 的依赖查找器发出信号,表明这是一个其他人可能想要使用的格式良好的库。

There's a couple of things you can do:你可以做几件事:

  • Assuming the package actually includes a libABC.so.1 and libABC.so.1()(64bit) is listed in the provides of the package, just let it be?假设 package 实际上包含一个libABC.so.1并且libABC.so.1()(64bit)列在 package 的提供中,就这样吧? It makes it easier for other programs to eventually depend on this library.它使其他程序更容易最终依赖这个库。

  • If you don't like this behaviour at all, you can just disable this entire feature.如果您根本不喜欢这种行为,您可以禁用整个功能。 Use AutoReq: no .使用AutoReq: no

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

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