]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: SKIP_RPATH if RPATH is not necessary
authorKefu Chai <kchai@redhat.com>
Fri, 30 Aug 2019 08:21:03 +0000 (16:21 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Apr 2021 12:27:30 +0000 (14:27 +0200)
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)

src/CMakeLists.txt
src/test/mon/CMakeLists.txt

index 93a5290331cc551ce322a46c9dd582f433f4a014..ed4bbc75d44d6e72cdda2b41d79bc318af541a39 100644 (file)
@@ -401,7 +401,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 4c8244a83abe3c04fd3092efd74ab050bd62c017..1dfa017509919106f1a52153a59958cbfdb73186 100644 (file)
@@ -51,17 +51,23 @@ 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})