]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: SKIP_RPATH if RPATH is not necessary 30028/head
authorKefu Chai <kchai@redhat.com>
Fri, 30 Aug 2019 08:21:03 +0000 (16:21 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 3 Sep 2019 02:27:18 +0000 (10:27 +0800)
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>
src/CMakeLists.txt
src/test/mon/CMakeLists.txt

index da9e3fc01792da80ca7db7495ab4692e62dc63cf..dc7f9c75da3734aad35d5ae12996f5686c61249d 100644 (file)
@@ -410,7 +410,7 @@ target_link_libraries(ceph-common ${ceph_common_deps})
 # 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.
   #
index b206f27e52929c4129831fcc8b3a85c6e13cf3c2..e9cb36fdfe5526ff4270359fbc4c2f43a4ef854c 100644 (file)
@@ -44,18 +44,24 @@ target_link_libraries(unittest_mon_montypes mon global)
 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})