环境:ubuntu16.04, ros kinetic, tensorflow 1.8
0.写在前面
编译segmap花了好长时间,也碰到了各种各种的问题,最后我换了一台电脑,碰到了些其他的问题,但还是解决了。因此把我遇到的一些问题记录下来。
1.编译tensorflow_ros_cpp
从源码编译tensorflow的过程我写在了这儿
找不到tensorflow的问题
catkin_segmap/devel/../libtensorflow_cc.so not found
...
tensorflow_catkin was not found
...
Tensorflow was not found
需要我们设置tensorflow的路径
catkin build tensorflow_ros_cpp --cmake-args -DFORCE_TF_PIP_SEARCH="OFF" -DFORCE_TF_BAZEL_SEARCH="ON" -DTF_BAZEL_LIBRARY="/home/jinye/lib/tensorflow-r1.8/bazel-bin/tensorflow/libtensorflow_cc.so" -DTF_BAZEL_SRC_DIR="/home/jinye/lib/tensorflow-r1.8"
可以看到现在找到了tensorflow的位置.
2.编译segmapper
2.1:metis_catkin
CMake Error at metis_src-stamp/download-metis_src.cmake:21 (message):
error: downloading
'https://github.com/ethz-asl/thirdparty_library_binaries/raw/master/metis-5.1.0.tar.gz'
failed
status_code: 7
status_string: "Couldn't connect to server"
log: Trying 192.30.255.113...
Connected to github.com (192.30.255.113) port 443 (#0)
下载https://github.com/ethz-asl/thirdparty_library_binaries/raw/master/metis-5.1.0.tar.gz
并解压,重命名为metis_src,放到build/metis_catkin/metis_src-prefix/src/下,覆盖metis_src,并注掉/src/metis_catkin/CMakeLists.txt里的
# set(METIS_URL https://github.com/ethz-asl/thirdparty_library_binaries/raw/master/metis-5.1.0.tar.gz)
...
#URL ${METIS_URL}
...
#URL ${METIS_URL}
2.2:gtsam_catkin
Errors << gtsam_catkin:make /home/jinye/projects/catkin_segmap2/logs/gtsam_catkin/build.make.004.log
Ignoring Boost restriction on optional lvalue assignment from rvalues
metis catkin libs: /home/jinye/projects/catkin_segmap2/devel/lib/libmetis.so
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:
MKL_LAPACK_LIBRARY
linked by target "gtsam" in directory /home/jinye/projects/catkin_segmap2/build/gtsam_catkin/gtsam_src-prefix/src/gtsam_src/gtsam
make[2]: *** [gtsam_src-prefix/src/gtsam_src-stamp/gtsam_src-configure] Error 1
make[1]: *** [CMakeFiles/gtsam_src.dir/all] Error 2
make: *** [all] Error 2
cd /home/jinye/projects/catkin_segmap2/build/gtsam_catkin; catkin build --get-env gtsam_catkin | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -
...............................................................................
Failed << gtsam_catkin:make [ Exited with code 2 ]
Failed <<< gtsam_catkin [ 0.3 seconds ]
1.修改gtsam_catkin下面的CMakeList.txt
#GIT_REPOSITORY https://bitbucket.org/gtborg/gtsam.git
GIT_REPOSITORY https://gitee.com/zerolover/gtsam
#GIT_TAG 6b6a8495bb9148a415d98708707c10656b0b69a1
GIT_TAG c21186c6212798e665da6b5015296713ddfe8c1d
2.注释掉build/gtsam_catkin/gtsam_src-prefix/src/gtsam_src/CMakeLists.txt的一行
#find_package(MKL)
2.3:pcl_catkin
Errors << pcl_catkin:make /home/jinye/projects/catkin_segmap2/logs/pcl_catkin/build.make.009.log
Cloning into 'pcl_src'...
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Cloning into 'pcl_src'...
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Cloning into 'pcl_src'...
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
CMake Error at /home/jinye/projects/catkin_segmap2/build/pcl_catkin/pcl_src-prefix/tmp/pcl_src-gitclone.cmake:40 (message):
Failed to clone repository: 'https://github.com/ethz-asl/pcl'
Errors << pcl_catkin:make /home/jinye/projects/catkin_segmap2/logs/pcl_catkin/build.make.013.log
make[5]: *** No rule to make target '/tmp/build/80754af9/vtk_1549813600250/_build_env/x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/librt.so', needed by 'lib/libpcl_io.so.1.8.0'. Stop.
make[5]: *** No rule to make target '/home/jinye/anaconda3/lib/libtbb.so', needed by 'lib/libpcl_io.so.1.10.1'. Stop.
这些问题我没有解决,但是我在另外一台电脑编译的时候pcl竟然通过了…
2.4 glog_catkin
/bin/sh: 1: autoreconf: not found
系统缺少autoreconf
sudo apt-get install autoconf
2.5 segmapper
Errors << segmapper:make /home/jinye/projects/catkin_segmap/logs/segmapper/build.make.001.log
/usr/bin/ld: warning: libtensorflow_framework.so, needed by /home/jinye/projects/catkin_segmap/devel/lib/libtensorflow_cc.so, not found (try using -rpath or -rpath-link)
/home/jinye/projects/catkin_segmap/devel/lib/libtensorflow_cc.so: undefined reference to `tensorflow::_OptimizerOptions_default_instance_'
libtensorflow_cc.so找不到,其实在devel/lib/下是存在的,可能跟libtensorflow_framework.so有关
因此将tensorflow-r1.8/bazel-bin/tensorflow/libtensorflow_framework.so 复制到devel/lib下。
最后贴上编译segmap成功的图片
2.6 protobuf
roslaunch segmapper kitti_loop_closure.launch遇到的问题
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
可以看到protobuf的版本不对,需要3.5.0的版本,关于protobuf的编译安装可以参考这篇博客
https://www.cnblogs.com/learn21cn/p/6206206.html
参考
https://github.com/ethz-asl/segmap/issues/108
https://github.com/ethz-asl/segmap/issues/154
https://blog.csdn.net/weixin_42606990/article/details/109738833