From f23ab7a1baeafb145f0ac58ad817e0ec7c6fe6d9 Mon Sep 17 00:00:00 2001 From: Marco Clemencic <marco.clemencic@cern.ch> Date: Tue, 7 Dec 2021 12:39:24 +0100 Subject: [PATCH] Do not link GaudiGoogleProfiling against tcmalloc and profiler --- GaudiProfiling/CMakeLists.txt | 7 +++++-- cmake/modules/Findgperftools.cmake | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/GaudiProfiling/CMakeLists.txt b/GaudiProfiling/CMakeLists.txt index 701d091510..67bd77afa9 100644 --- a/GaudiProfiling/CMakeLists.txt +++ b/GaudiProfiling/CMakeLists.txt @@ -48,12 +48,15 @@ endif() # Google PerfTools profiler #----------------------------------- if(GAUDI_USE_GPERFTOOLS) + # Note we do not link against libtcmalloc.so or libprofiler.so as they have to be + # preloaded (see next comment) gaudi_add_module(GaudiGoogleProfiling SOURCES src/component/google/GoogleAuditor.cpp LINK GaudiKernel GaudiAlgLib - ZLIB::ZLIB - gperftools::gperftools) + ZLIB::ZLIB) + # but we still need to add the include directories to the search path + target_include_directories(GaudiGoogleProfiling PRIVATE ${GPERFTOOLS_INCLUDE_DIRS}) # Special handling of unresolved symbols in GaudiGoogleProfiling. # The profilers need to have libtcmalloc.so or libprofiler.so pre-loaded to diff --git a/cmake/modules/Findgperftools.cmake b/cmake/modules/Findgperftools.cmake index f9e2c0d061..080b24c814 100644 --- a/cmake/modules/Findgperftools.cmake +++ b/cmake/modules/Findgperftools.cmake @@ -133,7 +133,8 @@ endif() if(COMMAND __deprecate_var_for_target) foreach(v IN ITEMS GPERFTOOLS_INCLUDE_DIR - GPERFTOOLS_INCLUDE_DIRS GPERFTOOLS_TCMALLOC_LIBRARY + # GPERFTOOLS_INCLUDE_DIRS + GPERFTOOLS_TCMALLOC_LIBRARY GPERFTOOLS_TCMALLOC_DEBUG_LIBRARY GPERFTOOLS_TCMALLOC_MINIMAL_LIBRARY GPERFTOOLS_TCMALLOC_AND_PROFILER_LIBRARY -- GitLab