0

My product foo is composed of a library: libfoo.so and an executable: foo, which depends on libfoo.so and on a third-party libbar.so.

I use CPack to get a RPM of foo which contains lib/libfoo.so and bin/foo.

But in the end I can't install the package: rpm -ivh complains about a needed dependency: libfoo.so.

I understand that automatic dependency resolution finds that foo needs libfoo.so but the purpose of installing the package is to provide that library.

If I disable automatic dependency resolution with CPACK_RPM_PACKAGE_AUTOREQ, the RPM looses libbar.so dependency as well.

How should I configure CPack in order to keep external dependencies but not internal ones?

mouviciel
  • 66,855
  • 13
  • 106
  • 140

1 Answers1

1

My Bad.

Automatic dependency detection was fooled by wrong file permissions: both bin/foo and lib/libfoo.so had rw-rw-r-- permissions, missing x.

To fix the issue, I just added USE_SOURCE_PERMISSIONS flag to CMake install(DIRECTORY ...) directive:

install(DIRECTORY    "${PROJECT_BINARY_DIR}/bin"
        DESTINATION  "${INSTALL_DIR}"
        USE_SOURCE_PERMISSIONS)
install(DIRECTORY    "${PROJECT_BINARY_DIR}/lib"
        DESTINATION  "${INSTALL_DIR}"
        USE_SOURCE_PERMISSIONS)
mouviciel
  • 66,855
  • 13
  • 106
  • 140
  • A similar question, [“Missing” lib for rpm install when it is present in rpm file](https://stackoverflow.com/q/27445918/45249), gives a [similar answer](https://stackoverflow.com/a/39819960/45249) – mouviciel Mar 12 '19 at 09:54