2016-11-20 151 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)