2016-11-20 152 views
2

在catkin项目中,catkin_make失败。该CMakeLists包括如何设置gperftools路径变量GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR?

find_package(Gperftools REQUIRED) 

我已经安装了谷歌,perftools:

google-perftools is already the newest version (2.4-0ubuntu5) 

CMake的错误说,它无法找到gperftools,或至少路径变量:

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): 
    Could NOT find Gperftools (missing: GPERFTOOLS_LIBRARIES 
    GPERFTOOLS_INCLUDE_DIR) 
Call Stack (most recent call first): 
    /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) 
    tuw_mpn/FindGperftools.cmake:39 (find_package_handle_standard_args) 
    tuw_mpn/CMakeLists.txt:40 (find_package) 

几个后几个小时的搜索我还没有找到设置的描述。有人能解释我如何解决这个错误?

在此先感谢,希望我已经为此问题提供了足够的信息。

干杯, 迈克尔

+0

一般建议/stackoverflow.com/q/39126648/2799037如果这没有帮助,你必须要求更具体。你有没有删除你的CMake缓存/编译目录并重试? – usr1234567

回答

2

不知道你使用的脚本FindGperftools.cmake,但this one搜索库tcmalloc_and_profiler和头gperftools/heap-profiler.h

但是包google-perftoolsdoesn't provide这些文件。 (其实这个软件包没有提供任何头文件或库)。

该库是​​由libgoogle-perftools4包装。可能应该有一些提供标题的devel包。

1

您需要提供FindGperftools.cmake

例如来自: https://github.com/vast-io/vast/blob/master/cmake/FindGperftools.cmake

CMakeLists.txt添加以下内容:http:/如何教CMake的寻找图书馆

# set the path to the library folder 
link_directories(/usr/local/lib) 

#Append Gperftools_DIR 
LIST(APPEND CMAKE_MODULE_PATH "/DirectoryWhereTheFindGperftools.cmakeIs") 

find_package(Gperftools REQUIRED)