some executables like ceph_test_mon_memory_target do not link against
libraries built from source tree, like librados and libceph-common. so
cmake does not set RPATH for them. hence cmake complains like:
before this change, `CMAKE_INSTALL_RPATH` is set globally. so cmake is
asked to rewrite the RPATH for all installed targets. but this is not
needed. as some executables do not link against libceph-common. hence,
cmake complains when installing them, like:
CMake Error at src/test/mon/cmake_install.cmake:90 (file):
file RPATH_CHANGE could not write new RPATH:
/usr/lib64/ceph
to the file:
/home/abuild/rpmbuild/BUILDROOT/ceph-15.0.0-4347.g85a07b9.x86_64/usr/bin/ceph_test_log_rss_usage
No valid ELF RPATH or RUNPATH entry exists in the file;
after this change, `SKIP_RPATH` is set for those executables which do
not link against any libraries created from ceph source tree. so we can
avoid setting the RPATH for these executables when `make install`.
the same applies to libceph-common.
Fixes: https://tracker.ceph.com/issues/41524
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
61708155b4d9d211b7da21aed8ccfe4c8ed3d932)
# appease dpkg-shlibdeps
set_target_properties(ceph-common PROPERTIES
SOVERSION 0
- INSTALL_RPATH "")
+ SKIP_RPATH TRUE)
if(NOT APPLE AND NOT FREEBSD)
# Apple uses Mach-O, not ELF. so this option does not apply to APPLE.
#
add_executable(ceph_test_mon_memory_target
test_mon_memory_target.cc)
target_link_libraries(ceph_test_mon_memory_target Boost::system Threads::Threads)
+set_target_properties(ceph_test_mon_memory_target PROPERTIES
+ SKIP_RPATH TRUE)
install(TARGETS ceph_test_mon_memory_target
DESTINATION ${CMAKE_INSTALL_BINDIR})
# ceph_test_mon_log_rss_usage
add_executable(ceph_test_log_rss_usage
test_log_rss_usage.cc)
+set_target_properties(ceph_test_log_rss_usage PROPERTIES
+ SKIP_RPATH TRUE)
install(TARGETS ceph_test_log_rss_usage
DESTINATION ${CMAKE_INSTALL_BINDIR})
# ceph_test_mon_rss_usage
add_executable(ceph_test_mon_rss_usage
test_mon_rss_usage.cc)
+set_target_properties(ceph_test_mon_rss_usage PROPERTIES
+ SKIP_RPATH TRUE)
install(TARGETS ceph_test_mon_rss_usage
DESTINATION ${CMAKE_INSTALL_BINDIR})