I am trying to use install(TARGETS...RUNTIME_DEPENDENCIES...)
with CMake 3.30 in an Ubuntu 14 Docker container. When I try to run the generated cmake_install.cmake file with cmake -P
, I get an error
file Could not resolve runtime dependencies:
libboost_system.so.1.57.0
libcrypto.so.3
libssl.so.3
even though ldd has no problems resolving everything correctly with or without LDD_LIBRARY_PATH
being set. These libraries exist in custom (not system-wide) directories and the directories are listed in the RUNPATH
. There are no complaints about other dependencies. One curious thing is that there are no complaints about other boost library dependencies existing in the same directory as libboost_system.
I created a simple custom test.cmake script to just run file(GET_RUNTIME_DEPENDENCIES...
) on a binary:
file(GET_RUNTIME_DEPENDENCIES
RESOLVED_DEPENDENCIES_VAR resolved
UNRESOLVED_DEPENDENCIES_VAR unresolved
CONFLICTING_DEPENDENCIES_PREFIX "con"
EXECUTABLES ${EXECUTABLES}
LIBRARIES ${LIBRARIES}
PRE_EXCLUDE_REGEXES
"^/lib/.*"
"^/usr/.*"
POST_EXCLUDE_REGEXES
"^/lib/.*"
"^/usr/.*"
)
message(STATUS "Resolved: \"${resolved}\"")
message(STATUS "Unresolved: \"${unresolved}\"")
message(STATUS "Conflicts: \"${con_FILENAMES}\"")
and when I run it specifying my executable, I get
– Resolved: “…;/3rdparty/boost/lib/libboost_filesystem.so.1.57.0;/3rdparty/boost/lib/libboost_regex.so.1.57.0;/3rdparty/boost/lib/libboost_system.so.1.57.0;/3rdparty/boost/lib/libboost_thread.so.1.57.0;/3rdparty/openssl/lib/libcrypto.so.3;…;/3rdparty/openssl/lib/libssl.so.3;…”
– Unresolved: “libcrypto.so.3;libssl.so.3”
– Conflicts: “”
This is very confusing, as libboost_system is not in the Unresolved list, and libssl and libcrypto are both resolved and unresolved,
Here is an excerpt from objdump -p
run on the executable:
Dynamic Section:
…
NEEDED libboost_thread.so.1.57.0
…
NEEDED libboost_filesystem.so.1.57.0
NEEDED libboost_system.so.1.57.0
…
NEEDED libboost_regex.so.1.57.0
NEEDED libssl.so.3
NEEDED libcrypto.so.3
…
RUNPATH …:/3rdparty/boost/lib:…:/3rdparty/openssl/lib:…
Any suggestions on how to get clarity on the cause of the problem and its solution are appreciated.