4

In a catkin project the catkin_make fails. The CMakeLists includes

find_package(Gperftools REQUIRED) 

I have installed google-perftools:

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

The CMake Error says it cannot find gperftools, or at least the path variables:

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)

After a few hours of searching I haven't found a description of the setup. Could someone please explain how I can solve this error?

Thanks in advance and I hope I have provided enough information for this problem.

Cheers, Michael

mkoller
  • 49
  • 1
  • 2
  • General advice on how to teach CMake to find libraries: http://stackoverflow.com/q/39126648/2799037 If this does not help, you have to ask more specific. Have you ever deleted your CMake cache / build directory and tried again? – usr1234567 Nov 20 '16 at 20:35

3 Answers3

3

I use Ubuntu 16.04 and have the same problems with you. I think the problem is lack some packages:

sudo apt-get install gperf  libgoogle-perftools-dev

have solved my problems,you can have a try.

TanLingxiao
  • 402
  • 5
  • 7
2

Not sure which script FindGperftools.cmake you use, but this one searches for library tcmalloc_and_profiler and header gperftools/heap-profiler.h.

But package google-perftools doesn't provide these files. (Actually, this package doesn't provide any headers or library.)

The library is provided by libgoogle-perftools4 package. Probably, there are should be some devel package which provides the header.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
2

You need to provide FindGperftools.cmake

For example from: https://github.com/vast-io/vast/blob/master/cmake/FindGperftools.cmake

In the CMakeLists.txt add the following:

# 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)
Arnox
  • 130
  • 8