From: Kefu Chai Date: Fri, 29 Jul 2016 03:27:34 +0000 (+0800) Subject: cmake: exclude private symbols in librbd X-Git-Tag: ses5-milestone5~253^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=417c54f1ef58c575267bd2dc11b2f9675f535007;p=ceph.git cmake: exclude private symbols in librbd missed it in 0edfad0. * librbd: pass '--exclude-libs,ALL' to linker * rbd: link against used libraries explicitly, rbd is accessing some internal symbols not exposed by librbd. Signed-off-by: Kefu Chai --- diff --git a/src/cls/CMakeLists.txt b/src/cls/CMakeLists.txt index 659662726c85..185da04f7f8c 100644 --- a/src/cls/CMakeLists.txt +++ b/src/cls/CMakeLists.txt @@ -19,6 +19,7 @@ if (WITH_RBD) install(TARGETS cls_rbd DESTINATION ${cls_dir}) add_library(cls_rbd_client STATIC rbd/cls_rbd_client.cc rbd/cls_rbd_types.cc) + target_link_libraries(cls_rbd_client cls_lock_client) endif (WITH_RBD) # cls_lock diff --git a/src/journal/CMakeLists.txt b/src/journal/CMakeLists.txt index e5337127200d..50b8c307cb28 100644 --- a/src/journal/CMakeLists.txt +++ b/src/journal/CMakeLists.txt @@ -12,3 +12,4 @@ set(journal_srcs ObjectRecorder.cc Utils.cc) add_library(journal STATIC ${journal_srcs}) +target_link_libraries(journal cls_journal_client) diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt index a08f17d61377..216f76d666f5 100644 --- a/src/librbd/CMakeLists.txt +++ b/src/librbd/CMakeLists.txt @@ -98,6 +98,7 @@ if(ENABLE_SHARED) OUTPUT_NAME rbd VERSION 1.0.0 SOVERSION 1 - COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden") + COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden" + LINK_FLAGS "-Wl,--exclude-libs,ALL") endif(ENABLE_SHARED) install(TARGETS librbd DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/rbd_fuse/CMakeLists.txt b/src/rbd_fuse/CMakeLists.txt index efeda706cc8a..61a02d3ad0e8 100644 --- a/src/rbd_fuse/CMakeLists.txt +++ b/src/rbd_fuse/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(rbd-fuse rbd-fuse.cc) target_link_libraries(rbd-fuse - librbd librados ${FUSE_LIBRARIES}) + librbd librados common ${FUSE_LIBRARIES}) install(TARGETS rbd-fuse DESTINATION bin) diff --git a/src/test/librbd/CMakeLists.txt b/src/test/librbd/CMakeLists.txt index 560ec50e4eeb..ad2cf9488ce2 100644 --- a/src/test/librbd/CMakeLists.txt +++ b/src/test/librbd/CMakeLists.txt @@ -133,6 +133,7 @@ add_executable(ceph_test_librbd_fsx target_link_libraries(ceph_test_librbd_fsx librbd librados + journal global m ${CMAKE_DL_LIBS} diff --git a/src/tools/rbd/CMakeLists.txt b/src/tools/rbd/CMakeLists.txt index 36c7303b45ff..42d3a5d0e5b3 100644 --- a/src/tools/rbd/CMakeLists.txt +++ b/src/tools/rbd/CMakeLists.txt @@ -42,7 +42,12 @@ add_executable(rbd ${rbd_srcs} $ $) set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd) -target_link_libraries(rbd librbd librados global common keyutils udev +target_link_libraries(rbd librbd librados + cls_journal_client cls_rbd_client + rbd_types + journal + common global + keyutils udev ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS}) install(TARGETS rbd DESTINATION bin)