今天编译cartographer遇到问题:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GMOCK_LIBRARY
    linked by target "time_conversion_test" in directory /home/dh-ubuntu/carto_ws/src/cartographer_ros/cartographer_ros
    linked by target "configuration_files_test" in directory /home/dh-ubuntu/carto_ws/src/cartographer_ros/cartographer_ros
    linked by target "msg_conversion_test" in directory /home/dh-ubuntu/carto_ws/src/cartographer_ros/cartographer_ros
    linked by target "metrics_test" in directory /home/dh-ubuntu/carto_ws/src/cartographer_ros/cartographer_ros

-- Configuring incomplete, errors occurred!

根据网上的提示,安装sudo apt install libgmock-dev,一直失败。

最后通过重新安装gtest包,解决:

下载gtest,release-1.8.0

       git clone https://github.com/google/googletest

  如果下载太慢:

  git clone https://gitee.com/anynone/google-googletest.git

gtest编译

  cd googletest

生成Makefile文件(先安装cmake,brew install cmake),继续输入命令编译:

  cmake CMakeLists.txt

执行make,生成两个静态库:libgtest.a libgtest_main.a

  make

最后将lib中的文件全部拷贝到  /usr/lib

posted on 2021-09-28 23:31  常青dinghou  阅读(897)  评论(0编辑  收藏  举报