From 12cd05b4cb19be8aed66adc815b2e85ba1e18457 Mon Sep 17 00:00:00 2001 From: Leo Chen <39020268+leo0519@users.noreply.github.com> Date: Mon, 27 Mar 2023 15:55:13 +0800 Subject: [PATCH] Fix the compilation of rocksdb error (undefined z and dl) (#51744) --- cmake/external/rocksdb.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/external/rocksdb.cmake b/cmake/external/rocksdb.cmake index f2bca6fea63..e6a77a3ee10 100644 --- a/cmake/external/rocksdb.cmake +++ b/cmake/external/rocksdb.cmake @@ -36,7 +36,7 @@ set(ROCKSDB_FLAGS "-DNDEBUG -DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DHAVE_SSE42 -DHAVE_PCLMUL -DZLIB -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_SUPPORT_THREAD_LOCAL -DROCKSDB_USE_RTTI -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_AUXV_GETAUXVAL_PRESENT" ) set(ROCKSDB_CMAKE_CXX_FLAGS - "${ROCKSDB_COMMON_FLAGS} -DROCKSDB_LIBAIO_PRESENT -msse -msse4.2 -mpclmul ${ROCKSDB_FLAGS} -fPIC -I${JEMALLOC_INCLUDE_DIR} -lz -ldl" + "${ROCKSDB_COMMON_FLAGS} -DROCKSDB_LIBAIO_PRESENT -msse -msse4.2 -mpclmul ${ROCKSDB_FLAGS} -fPIC -I${JEMALLOC_INCLUDE_DIR} -Wl,--no-as-needed -lz -ldl" ) set(ROCKSDB_CMAKE_C_FLAGS "${ROCKSDB_COMMON_FLAGS} ${ROCKSDB_FLAGS} -DROCKSDB_LIBAIO_PRESENT -fPIC -I${JEMALLOC_INCLUDE_DIR}" @@ -44,7 +44,7 @@ set(ROCKSDB_CMAKE_C_FLAGS include_directories(${ROCKSDB_INCLUDE_DIR}) set(CMAKE_CXX_LINK_EXECUTABLE - "${CMAKE_CXX_LINK_EXECUTABLE} -pthread -ldl -lrt -lz") + "${CMAKE_CXX_LINK_EXECUTABLE} -pthread -Wl,--no-as-needed -ldl -lrt -lz") ExternalProject_Add( extern_rocksdb ${EXTERNAL_PROJECT_LOG_ARGS} -- GitLab