From b75c58bf61ce1283667ab365f1158f17bb5a0a59 Mon Sep 17 00:00:00 2001 From: Zhengguo Yang Date: Thu, 11 Aug 2022 12:47:14 +0800 Subject: [PATCH] fix some compile problem like --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f46dc0ee5..88369c06ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,11 @@ include_directories( ${OPENSSL_INCLUDE_DIR} ) +set(WL_START_GROUP "-Wl,--start-group") +set(WL_END_GROUP "-Wl,--end-group") + set(DYNAMIC_LIB + ${WL_START_GROUP} ${GFLAGS_LIBRARY} ${PROTOBUF_LIBRARIES} ${LEVELDB_LIB} @@ -220,7 +224,7 @@ else() list(APPEND DYNAMIC_LIB ${OPENSSL_SSL_LIBRARY}) endif() -set(BRPC_PRIVATE_LIBS "-lgflags -lprotobuf -lleveldb -lprotoc -lssl -lcrypto -ldl -lz") +set(BRPC_PRIVATE_LIBS ${WL_START_GROUP} "-lgflags -lprotobuf -lleveldb -lprotoc -lssl -lcrypto -ldl -lz") if(WITH_GLOG) set(DYNAMIC_LIB ${DYNAMIC_LIB} ${GLOG_LIB}) @@ -249,6 +253,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") "-Wl,-U,_ProfilerStop") endif() +set(DYNAMIC_LIB "${DYNAMIC_LIB} ${WL_END_GROUP}") +set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} ${WL_END_GROUP}") + # for *.so set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/output/lib) # for *.a