0

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.

AnotherDeveloper
  • 2,161
  • 2
  • 23
  • 27

1 Answers1

1

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.

omajid
  • 14,165
  • 4
  • 47
  • 64
  • Thanks @omajid. You aptly explained the reason which leads to solution. I was late is commenting as I had solved the problem yesterday by myself. The first insight I got was from Danny's comment here( https://stackoverflow.com/questions/27445918/missing-lib-for-rpm-install-when-it-is-present-in-rpm-file#comment118069251_27445918 ). I wanted to confirm the theory hence I digged more & with the help of this link: https://cmake.org/pipermail/cmake/2011-February/042829.html , I viewed the files generated & hence the solution. – AnotherDeveloper Nov 30 '21 at 03:28
  • For those who want to know the change for the solution. I just added 755 permission to my names. More precisely : install ( DIRECTORY DESTINATION FILES_MATCHING PATTERN "libABC.so*" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) – AnotherDeveloper Nov 30 '21 at 03:29