From 36a3c714498dd901d39456dc3ecfa6bbaef0fa94 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:07:03 +0800 Subject: [PATCH] fix gpertools initializer --- 3party/gperftools/src/base/googleinit.h | 5 ++++- CMakeLists.txt | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/3party/gperftools/src/base/googleinit.h b/3party/gperftools/src/base/googleinit.h index d3fda39..01ba448 100644 --- a/3party/gperftools/src/base/googleinit.h +++ b/3party/gperftools/src/base/googleinit.h @@ -63,7 +63,10 @@ private: namespace { \ static void google_init_module_##name() { body; } \ GoogleInitializer google_initializer_module_##name(#name, google_init_module_##name, NULL); \ - __attribute__((constructor)) static void EnsureConstructorRunsBeforeMain() { google_init_module_##name().name(); } \ + __attribute__((constructor)) static void EnsureConstructorRunsBeforeMain() \ + { \ + google_initializer_module_##name().name(); \ + } \ } #define REGISTER_MODULE_DESTRUCTOR(name, body) \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f157a2..1587a09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,12 +106,13 @@ target_sources( target_link_libraries( sled - PUBLIC rpc_core fmt marl Async++ minilua protobuf::libprotobuf + PUBLIC rpc_core fmt marl Async++ minilua # protobuf::libprotoc PRIVATE dl) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") target_link_libraries(sled PRIVATE tcmalloc_and_profiler_static) endif() + if(SLED_WITH_PROTOBUF) target_link_libraries(sled PUBLIC protobuf::libprotobuf) endif()