本文主要是介绍cartographer编译失败,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
cartographer编译失败
cartographer在编译的过程中,报错:multiple rules generate CMakeFiles/ ,提示编译pb.cc 文件冲突;把ninja换成1.8版本。报错消失。
Base path: /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws
Source space: /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/src
Build space: /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/build_isolated
Devel space: /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/devel_isolated
Install space: /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/install_isolated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~ traversing 4 packages in topological order:
~~ - cartographer (plain cmake)
~~ - cartographer_ros_msgs
~~ - cartographer_ros
~~ - cartographer_rviz
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> Processing plain cmake package: 'cartographer'
build.ninja exists, skipping explicit cmake invocation...
==> ninja build.ninja in '/home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/build_isolated/cartographer/install'
ninja: warning: bad deps log signature or version; starting over
[0/1] Re-running CMake...
-- Build type: Release
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.7 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.2
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.13.0 installed in: /usr/local with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations, C++11, OpenMP]
20220222 I can find Sphinx
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/build_isolated/cartographer/install
ninja: no work to do.
==> ninja -j24 -l24 in '/home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/build_isolated/cartographer/install'
ninja: error: '/home/sukai/workspace/cartographer/cartographer_ws/src/cartographer/scripts/protobuf/build/libprotobuf.a', needed by 'cartographer_pbstream', missing and no known rule to make it
<== Failed to process package 'cartographer':
Command '['ninja', '-j24', '-l24']' returned non-zero exit status 1.
Reproduce this error by running:
==> cd /home/sukai/workspace/0/137/cartographer_noetic/cartographer2022-07-11/cartographer_ws/build_isolated/cartographer && ninja -j24 -l24
Command failed, exiting.
解决:换ninja-1.8版
ubuntu 安装ninja
1.安装依赖re2c
root@ubuntu:~# apt-get install re2c
root@ubuntu:~# re2c --version
re2c 1.0.1
2.下载ninja (1.8版本,1.12版本也会报同样错误,其它版本自己试)
git clone https://github.com/ninja-build/ninja.git
3.编译ninja
cd ninja
./configure.py --bootstrap
4.安装ninja
cp ./ninja /usr/bin
ninja --version
5.打开控制台进入自己的项目
cd /home/sukai/cartographer_ws/src/cartographer/
依次执行:
protoc cartographer/cloud/proto/*.proto --cpp_out=.
protoc cartographer/common/proto/*.proto --cpp_out=.
protoc cartographer/ground_truth/proto/*.proto --cpp_out=.
protoc cartographer/mapping/proto/*.proto --cpp_out=.
protoc cartographer/mapping/proto/pose_graph/*.proto --cpp_out=.
protoc cartographer/mapping/proto/scan_matching/*.proto --cpp_out=.
protoc cartographer/sensor/proto/*.proto --cpp_out=.
protoc cartographer/transform/proto/*.proto --cpp_out=.
protoc cartographer/kalman_filter/proto/*.proto --cpp_out=.
然后
cd /home/sukai/cartographer_ws
编译:
catkin_make_isolated --install --use-ninja
source ~/home/sukai/cartographer_ws/install_isolated/setup.bash
这篇关于cartographer编译失败的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!