Commit c744500a authored by zyearn's avatar zyearn

remove lrt in mac environment

add weak symbol _RegisterThriftProtocol in mac
fix the version get in the latest MacOS 10.13+
parent 02eb89f5
......@@ -158,7 +158,6 @@ set(DYNAMIC_LIB
${PROTOC_LIB}
${CMAKE_THREAD_LIBS_INIT}
${THRIFT_LIB}
rt
${SSL_LIB}
${CRYPTO_LIB}
dl
......@@ -183,7 +182,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop")
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol")
endif()
# for *.so
......
......@@ -276,7 +276,7 @@ if [ ! -z "$DEBUGSYMBOLS" ]; then
fi
if [ "$SYSTEM" = "Darwin" ]; then
CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations"
version=`system_profiler SPSoftwareDataType | grep "System Version" | awk '{print $5}' | awk -F. '{printf "%d.%d", $1, $2}'`
version=`sw_vers -productVersion | awk -F '.' '{print $1 "." $2}'`
if [[ `echo "$version<10.12" | bc -l` == 1 ]]; then
CPPFLAGS="${CPPFLAGS} -DNO_CLOCK_GETTIME_IN_MAC"
fi
......
......@@ -77,6 +77,7 @@
extern "C" {
// defined in gperftools/malloc_extension_c.h
void BAIDU_WEAK MallocExtension_ReleaseFreeMemory(void);
void BAIDU_WEAK RegisterThriftProtocol();
}
namespace brpc {
......@@ -97,7 +98,6 @@ using namespace policy;
const char* const DUMMY_SERVER_PORT_FILE = "dummy_server.port";
void __attribute__((weak)) RegisterThriftProtocol();
struct GlobalExtensions {
GlobalExtensions()
......@@ -467,9 +467,8 @@ static void GlobalInitializeOrDieImpl() {
}
// Register Thrift framed protocol if linked
if (brpc::RegisterThriftProtocol) {
brpc::RegisterThriftProtocol();
if (RegisterThriftProtocol) {
RegisterThriftProtocol();
}
// Only valid at client side
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment