# Install the required libraries that are available as debs.
sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
g++ \
git \
google-mock \
libboost-all-dev \
libcairo2-dev \
libcurl4-openssl-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
liblua5.2-dev \
libsuitesparse-dev \
lsb-release \
ninja-build \
stow
# Install Ceres Solver and Protocol Buffers support if available.
# No need to build it ourselves.
if [[ "$(lsb_release -sc)" = "focal" || "$(lsb_release -sc)" = "buster" ]]
then
sudo apt-get install -y python3-sphinx libgmock-dev libceres-dev protobuf-compiler
else
sudo apt-get install -y python-sphinx
if [[ "$(lsb_release -sc)" = "bionic" ]]
then
sudo apt-get install -y libceres-dev
fi
fi
复制按回车键即可
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
mkdir build
cd build
cmake ..
make install
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash
在之前生成的工作目录下
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
source install_isolated/setup.bash
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
sudo apt-get install stow
sudo chmod +x ~/carto_ws/src/cartographer/scripts/install_abseil.sh
cd ~/carto_ws/src/cartographer/scripts
./install_abseil.sh
cartographer/mapping/proto/trajectory_node_data.proto:15:10: Unrecognized syntax identifier "proto3". This parser only recognizes "proto2".
ninja: build stopped: subcommand failed.
<== Failed to process package 'cartographer':
Command '['ninja']' returned non-zero exit status 1
解决方法:
sh src/cartographer/scripts/install_proto3.sh
sudo mv /usr/bin/protoc /usr/bin/protoc.bk
sudo ln -s /usr/local/bin/protoc /usr/bin/protoc
al/lib/libabsl_civil_time.a /usr/local/lib/libabsl_time_zone.a -lpthread && :
/usr/bin/ld: /usr/local/lib/liblua.a(loadlib.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: 无法添加符号: DSO missing from command line
collect2: error: ld returned 1 exit status
[270/384] Building CXX object CMakeFiles/cartographer.mapping.map_builder_test.dir/cartographer/mapping/map_builder_test.cc.o
ninja: build stopped: subcommand failed.
<== Failed to process package 'cartographer':
Command '['ninja', '-j8', '-l8']' returned non-zero exit status 1
Reproduce this error by running:
==> cd /home/nie/cartographer_detailed_comments_ws/build_isolated/cartographer && ninja -j8 -l8
解决方法:
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
find_package(Eigen3 REQUIRED)
find_package(LuaGoogle REQUIRED)
set(LUA_LIBRARIES "/usr/local/lib/liblua.a;/usr/lib/x86_64-linux-gnu/libdl.so")
absl_strings.a /usr/local/lib/libabsl_strings_internal.a /usr/local/lib/libabsl_throw_delegate.a /usr/local/lib/libabsl_base.a /usr/local/lib/libabsl_dynamic_annotations.a /usr/local/lib/libabsl_spinlock_wait.a -lpthread /usr/local/lib/libabsl_int128.a /usr/local/lib/libabsl_civil_time.a /usr/local/lib/libabsl_time_zone.a -lpthread && :
/usr/bin/ld: /usr/local/lib/liblua.a(lstate.o): relocation R_X86_64_PC32 against symbol `lua_newstate' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 最后的链结失败: 错误的值
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
<== Failed to process package 'cartographer_rviz':
Command '['/home/nie/cartographer_detailed_comments_ws/install_isolated/env.sh', 'ninja', '-j8', '-l8']' returned non-zero exit status 1
Reproduce this error by running:
==> cd /home/nie/cartographer_detailed_comments_ws/build_isolated/cartographer_rviz && /home/nie/cartographer_detailed_comments_ws/install_isolated/env.sh ninja -j8 -l8
解决方法,重新安装lua5.3
curl -R -O http://www.lua.org/ftp/lua-5.3.0.tar.gz
tar zxf lua-5.3.0.tar.gz
cd lua-5.3.0
make linux CFLAGS=-fPIC
sudo make install
注意,如果要二次编译lua5.3,记得要删除src下已经编译好的.o对象文件,再进行编译
cd lua-5.3.0/src
rm *.o