Skip to content

Commit aeed399

Browse files
committed
Merge PR ceph#62865 into main
* refs/pull/62865/head: test/libcephfs: copy DT_NEEDED entries from input libraries test/fs: only add libcephfs as library dependency test/client: do not depend on libcephfs Reviewed-by: Viacheslav Dubeyko <[email protected]>
2 parents f8edbcc + c6ac71d commit aeed399

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

src/test/client/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if(${WITH_CEPHFS})
1212
client
1313
global
1414
ceph-common
15-
cephfs
1615
${UNITTEST_LIBS}
1716
${EXTRALIBS}
1817
${CMAKE_DL_LIBS}

src/test/fs/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ if(${WITH_CEPHFS})
99
add_executable(ceph_test_trim_caps
1010
test_trim_caps.cc
1111
)
12-
target_link_libraries(ceph_test_trim_caps ceph-common cephfs)
12+
target_link_libraries(ceph_test_trim_caps
13+
cephfs
14+
)
1315
install(TARGETS ceph_test_trim_caps DESTINATION ${CMAKE_INSTALL_BINDIR})
1416

1517
add_executable(ceph_test_ino_release_cb
1618
test_ino_release_cb.cc
1719
)
18-
target_link_libraries(ceph_test_ino_release_cb ceph-common cephfs)
20+
target_link_libraries(ceph_test_ino_release_cb
21+
cephfs
22+
)
1923
install(TARGETS ceph_test_ino_release_cb DESTINATION ${CMAKE_INSTALL_BINDIR})
2024
endif(${WITH_CEPHFS})

src/test/libcephfs/CMakeLists.txt

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# Note:
2+
#
3+
# target_link_options(ceph_test_libcephfs PRIVATE -Wl,--copy-dt-needed-entries)
4+
#
5+
# This is done due to this linker error:
6+
#
7+
# FAILED: bin/ceph_test_libcephfs_newops
8+
# : && /usr/bin/g++-11 -Og -g -rdynamic -pie src/test/libcephfs/CMakeFiles/ceph_test_libcephfs_newops.dir/main.cc.o src/test/libcephfs/CMakeFiles/ceph_test_libcephfs_newops.dir/newops.cc.o -o bin/ceph_test_libcephfs_newops -Wl,-rpath,/home/ubuntu/ceph/build/lib: lib/libcephfs.so.2.0.0 lib/libgmock_main.a lib/libgmock.a lib/libgtest.a -ldl -ldl /usr/lib/x86_64-linux-gnu/librt.a -lresolv -ldl lib/libceph-common.so.2 lib/libjson_spirit.a lib/libcommon_utf8.a lib/liberasure_code.a lib/libextblkdev.a -lcap boost/lib/libboost_thread.a boost/lib/libboost_chrono.a boost/lib/libboost_atomic.a boost/lib/libboost_system.a boost/lib/libboost_random.a boost/lib/libboost_program_options.a boost/lib/libboost_date_time.a boost/lib/libboost_iostreams.a boost/lib/libboost_regex.a lib/libfmtd.a /usr/lib/x86_64-linux-gnu/libblkid.so /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libudev.so /usr/lib/x86_64-linux-gnu/libz.so src/opentelemetry-cpp/sdk/src/trace/libopentelemetry_trace.a src/opentelemetry-cpp/sdk/src/resource/libopentelemetry_resources.a src/opentelemetry-cpp/sdk/src/common/libopentelemetry_common.a src/opentelemetry-cpp/exporters/jaeger/libopentelemetry_exporter_jaeger_trace.a src/opentelemetry-cpp/ext/src/http/client/curl/libopentelemetry_http_client_curl.a /usr/lib/x86_64-linux-gnu/libcurl.so /usr/lib/x86_64-linux-gnu/libthrift.so -lresolv -ldl -Wl,--as-needed -latomic && :
9+
# /usr/bin/ld: lib/libcephfs.so.2.0.0: undefined reference to symbol '_ZN4ceph18__ceph_assert_failERKNS_11assert_dataE'
10+
# /usr/bin/ld: lib/libceph-common.so.2: error adding symbols: DSO missing from command line
11+
# collect2: error: ld returned 1 exit status
12+
#
13+
# Despite the presence of libceph-common.so.2 on the linker invocation, this
14+
# error persists. I (Patrick) have not found a resolution for this except to
15+
# make the linker behave in traditional manner where library dependencies are
16+
# assumed to be available. It seems like a linker bug and I have no explanation
17+
# for why it only affects a few test executables.
18+
119
if(WITH_LIBCEPHFS)
220
add_executable(ceph_test_libcephfs
321
test.cc
@@ -19,6 +37,9 @@ if(WITH_LIBCEPHFS)
1937
${EXTRALIBS}
2038
${CMAKE_DL_LIBS}
2139
)
40+
if(NOT WIN32)
41+
target_link_options(ceph_test_libcephfs PRIVATE -Wl,--copy-dt-needed-entries)
42+
endif()
2243
install(TARGETS ceph_test_libcephfs
2344
DESTINATION ${CMAKE_INSTALL_BINDIR})
2445

@@ -33,6 +54,9 @@ if(WITH_LIBCEPHFS)
3354
${EXTRALIBS}
3455
${CMAKE_DL_LIBS}
3556
)
57+
if(NOT WIN32)
58+
target_link_options(ceph_test_libcephfs_snapdiff PRIVATE -Wl,--copy-dt-needed-entries)
59+
endif()
3660
install(TARGETS ceph_test_libcephfs_snapdiff
3761
DESTINATION ${CMAKE_INSTALL_BINDIR})
3862

@@ -47,6 +71,9 @@ if(WITH_LIBCEPHFS)
4771
${EXTRALIBS}
4872
${CMAKE_DL_LIBS}
4973
)
74+
if(NOT WIN32)
75+
target_link_options(ceph_test_libcephfs_suidsgid PRIVATE -Wl,--copy-dt-needed-entries)
76+
endif()
5077
install(TARGETS ceph_test_libcephfs_suidsgid
5178
DESTINATION ${CMAKE_INSTALL_BINDIR})
5279

@@ -57,11 +84,13 @@ if(WITH_LIBCEPHFS)
5784
target_link_libraries(ceph_test_libcephfs_vxattr
5885
ceph-common
5986
cephfs
60-
librados
6187
${UNITTEST_LIBS}
6288
${EXTRALIBS}
6389
${CMAKE_DL_LIBS}
6490
)
91+
if(NOT WIN32)
92+
target_link_options(ceph_test_libcephfs_vxattr PRIVATE -Wl,--copy-dt-needed-entries)
93+
endif()
6594
install(TARGETS ceph_test_libcephfs_vxattr
6695
DESTINATION ${CMAKE_INSTALL_BINDIR})
6796

@@ -76,6 +105,9 @@ if(WITH_LIBCEPHFS)
76105
${EXTRALIBS}
77106
${CMAKE_DL_LIBS}
78107
)
108+
if(NOT WIN32)
109+
target_link_options(ceph_test_libcephfs_newops PRIVATE -Wl,--copy-dt-needed-entries)
110+
endif()
79111
install(TARGETS ceph_test_libcephfs_newops
80112
DESTINATION ${CMAKE_INSTALL_BINDIR})
81113

@@ -84,28 +116,33 @@ if(WITH_LIBCEPHFS)
84116
add_executable(ceph_test_libcephfs_reclaim
85117
reclaim.cc
86118
)
87-
target_link_libraries(ceph_test_libcephfs_reclaim
119+
target_link_libraries(ceph_test_libcephfs_reclaim
88120
ceph-common
89121
cephfs
90122
${UNITTEST_LIBS}
91123
${EXTRALIBS}
92124
${CMAKE_DL_LIBS}
93-
)
125+
)
126+
if(NOT WIN32)
127+
target_link_options(ceph_test_libcephfs_reclaim PRIVATE -Wl,--copy-dt-needed-entries)
128+
endif()
94129
install(TARGETS ceph_test_libcephfs_reclaim
95130
DESTINATION ${CMAKE_INSTALL_BINDIR})
96131
endif(NOT WIN32)
97132

98133
add_executable(ceph_test_libcephfs_lazyio
99134
lazyio.cc
100135
)
101-
target_link_libraries(ceph_test_libcephfs_lazyio
102-
ceph-common
136+
target_link_libraries(ceph_test_libcephfs_lazyio
103137
cephfs
104138
librados
105139
${UNITTEST_LIBS}
106140
${EXTRALIBS}
107141
${CMAKE_DL_LIBS}
108-
)
142+
)
143+
if(NOT WIN32)
144+
target_link_options(ceph_test_libcephfs_lazyio PRIVATE -Wl,--copy-dt-needed-entries)
145+
endif()
109146
install(TARGETS ceph_test_libcephfs_lazyio
110147
DESTINATION ${CMAKE_INSTALL_BINDIR})
111148

@@ -119,7 +156,10 @@ target_link_libraries(ceph_test_libcephfs_lazyio
119156
${UNITTEST_LIBS}
120157
${EXTRALIBS}
121158
${CMAKE_DL_LIBS}
122-
)
159+
)
160+
if(NOT WIN32)
161+
target_link_options(ceph_test_libcephfs_access PRIVATE -Wl,--copy-dt-needed-entries)
162+
endif()
123163
install(TARGETS ceph_test_libcephfs_access
124164
DESTINATION ${CMAKE_INSTALL_BINDIR})
125165

0 commit comments

Comments
 (0)