视觉SLAM十四讲 报错 No rule to make target '/usr/local/lib/libDBoW3.a', needed by 'gen_vocab'.
1. 问题
在编译高博的视觉SLAM十四讲ch11的feature_training.cpp 时,编译报错:
make[2]: *** No rule to make target '/usr/local/lib/libDBoW3.a', needed by 'gen_vocab'. Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/usr/local/lib/libDBoW3.a', needed by 'loop_closure'. Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/usr/local/lib/libDBoW3.a', needed by 'feature_training'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 33%] Building CXX object CMakeFiles/gen_vocab.dir/gen_vocab_large.cpp.o
[ 33%] Building CXX object CMakeFiles/loop_closure.dir/loop_closure.cpp.o
[ 50%] Building CXX object CMakeFiles/feature_training.dir/feature_training.cpp.o
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/feature_training.dir/all' failed
make[1]: *** [CMakeFiles/feature_training.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
2. 原因
编译程序DBow3的链接问题。
3. 解决方案
首先先安装好DBow3,可以在https://github.com/rmsalinas/DBow3下载:
git clone https://github.com/rmsalinas/DBow3.git
cd DBow3
mkdir build
cd build
cmake ..
make -j8
sudo make install
在make install 之后,/usr/local/lib 其实就已经生成了DBow3的链接文件,但是是动态链接文件.so :
libDBoW3.so
由于高博给出的demo里使用的是3rdparty中的链接文件,离线链接文件使用.a 静态链接文件libDBoW3.a 会更好,所以只要把ch11中的CMakeLists.txt 静态链接改为动态链接即可:
set( DBoW3_LIBS "/usr/local/lib/libDBoW3.so" )
|