Home > Blockchain >  CentOS rpm package depends on lib "soname" which it builds using cmake
CentOS rpm package depends on lib "soname" which it builds using cmake

Time:11-30

I am trying to build a rpm package using cmake. This package builds a library and packages it well all is hunky-dory

In the next iteration, I add "soname" using the following commands

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:

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 -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 :

 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?

Also, why there is this problem happening only with the "sonames". There is no problem when soname is not added / packaged.

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

Describes the same problem as mine without using cmake (using plain spec files for rpm) but no solution. I tried to checked if there is some issue with architecture (x32 , x64 ) as discussed there but, it seems all fine.

CodePudding user response:

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).

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.

Libraries are a bit funny, because they are treated as both dependencies and a feature provided by the 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.

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? 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.

  • Related