From: Lucian Petrut Date: Tue, 11 Apr 2023 08:39:10 +0000 (+0000) Subject: cmake: avoid duplicate symbols X-Git-Tag: v19.0.0~575^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=936252524e9059ad90c8ba140ca45e7ff2f31105;p=ceph.git cmake: avoid duplicate symbols Some symbols from the crc32, arch and fmt libs are re-exported by libceph-common: FAILED: bin/unittest_time.exe ld.lld: error: fmt::v9::format_error::~format_error() was replaced llvm throws errors because of the duplicate symbols. One workaround is to use objects instead of static libs for the libs. For libfmt we'll use the header-only version. Signed-off-by: Lucian Petrut --- diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt index ba1157358a7c..e849e4896f4c 100644 --- a/src/arch/CMakeLists.txt +++ b/src/arch/CMakeLists.txt @@ -9,4 +9,4 @@ elseif(HAVE_PPC64LE OR HAVE_PPC64 OR HAVE_PPC) list(APPEND arch_srcs ppc.c) endif() -add_library(arch STATIC ${arch_srcs}) +add_library(arch OBJECT ${arch_srcs}) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 1297df32405a..695ea7a68b3e 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -229,7 +229,8 @@ elseif(HAVE_ARMV8_CRC) crc32c_aarch64.c) endif(HAVE_INTEL) -add_library(crc32 STATIC ${crc32_srcs}) +add_library(crc32 OBJECT ${crc32_srcs}) + if(HAVE_ARMV8_CRC) set_target_properties(crc32 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARMV8_CRC_COMPILE_FLAGS}") diff --git a/src/crimson/CMakeLists.txt b/src/crimson/CMakeLists.txt index e2b37fac9cbf..6b1b086db33e 100644 --- a/src/crimson/CMakeLists.txt +++ b/src/crimson/CMakeLists.txt @@ -148,7 +148,7 @@ target_link_libraries(crimson-common PUBLIC ${crimson_common_public_deps} PRIVATE - crc32 + crc32 arch ${crimson_common_deps} OpenSSL::Crypto) diff --git a/win32_build.sh b/win32_build.sh index 3644074ef441..c29b58491725 100755 --- a/win32_build.sh +++ b/win32_build.sh @@ -161,6 +161,7 @@ fi cmake -D CMAKE_PREFIX_PATH=$depsDirs \ -D MINGW_LINK_DIRECTORIES="$linkDirs" \ -D CMAKE_TOOLCHAIN_FILE="$MINGW_CMAKE_FILE" \ + -D WITH_FMT_HEADER_ONLY=ON \ -D WITH_LIBCEPHSQLITE=OFF \ -D WITH_RDMA=OFF -D WITH_OPENLDAP=OFF \ -D WITH_GSSAPI=OFF -D WITH_XFS=OFF \