diff --git a/cpp/cmake/ThirdPartyPackages.cmake b/cpp/cmake/ThirdPartyPackages.cmake index fed5dece88..28180b2c36 100644 --- a/cpp/cmake/ThirdPartyPackages.cmake +++ b/cpp/cmake/ThirdPartyPackages.cmake @@ -1676,14 +1676,18 @@ macro(build_gperftools) BUILD_BYPRODUCTS ${GPERFTOOLS_STATIC_LIB}) + ExternalProject_Add_StepDependencies(gperftools_ep build libunwind_ep) + file(MAKE_DIRECTORY "${GPERFTOOLS_INCLUDE_DIR}") - add_library(gperftools SHARED IMPORTED) + add_library(gperftools STATIC IMPORTED) set_target_properties(gperftools PROPERTIES IMPORTED_LOCATION "${GPERFTOOLS_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}") + INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES libunwind) add_dependencies(gperftools gperftools_ep) + add_dependencies(gperftools libunwind_ep) endmacro() if(MILVUS_WITH_GPERFTOOLS) @@ -1692,4 +1696,5 @@ if(MILVUS_WITH_GPERFTOOLS) # TODO: Don't use global includes but rather target_include_directories get_target_property(GPERFTOOLS_INCLUDE_DIR gperftools INTERFACE_INCLUDE_DIRECTORIES) include_directories(SYSTEM ${GPERFTOOLS_INCLUDE_DIR}) + link_directories(SYSTEM ${GPERFTOOLS_PREFIX}/lib) endif() diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index 31d1e66c4d..459297a855 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -63,10 +63,6 @@ include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include") include_directories(thrift/gen-cpp) include_directories(/usr/include/mysql) -if (MILVUS_ENABLE_PROFILING STREQUAL "ON") - SET(PROFILER_LIB profiler) -endif() - set(third_party_libs easyloggingpp sqlite @@ -85,7 +81,6 @@ set(third_party_libs zlib zstd mysqlpp - ${PROFILER_LIB} ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so cudart ) @@ -103,6 +98,12 @@ else() openblas) endif() +if (MILVUS_ENABLE_PROFILING STREQUAL "ON") + set(third_party_libs ${third_party_libs} + gperftools + libunwind) +endif() + if (GPU_VERSION STREQUAL "ON") link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64") set(engine_libs