本文引自链接:https://blog.csdn.net/qq_35590091/article/details/97789438
在cmake ..的时候进行到38%左右时出现了
[ 35%] Building CXX object gtsam/CMakeFiles/gtsam.dir/geometry/StereoCamera.cpp.o
[ 35%] Building CXX object gtsam/CMakeFiles/gtsam.dir/geometry/StereoPoint2.cpp.o
[ 38%] Building CXX object gtsam/CMakeFiles/gtsam.dir/geometry/Unit3.cpp.o
[ 38%] Building CXX object gtsam/CMakeFiles/gtsam.dir/geometry/triangulation.cpp.o
In file included from /data/code9/gtsam/gtsam/nonlinear/LevenbergMarquardtOptimizer.h:25:0,
from /data/code9/gtsam/gtsam/geometry/triangulation.cpp:22:
/data/code9/gtsam/gtsam/linear/VectorValues.h: In member function ‘std::pair<tbb::interface5::internal::solist_iterator<tbb::interface5::internal::split_ordered_list<std::pair<const long unsigned int, Eigen::Matrix<double, -1, 1> >, tbb::tbb_allocator<std::pair<const long unsigned int, Eigen::Matrix<double, -1, 1> > > >, std::pair<const long unsigned int, Eigen::Matrix<double, -1, 1> > >, bool> gtsam::VectorValues::tryInsert(gtsam::Key, const Vector&)’:
/data/code9/gtsam/gtsam/linear/VectorValues.h:200:22: error: ‘gtsam::VectorValues::Values {aka class gtsam::ConcurrentMap<long unsigned int, Eigen::Matrix<double, -1, 1> >}’ has no member named ‘emplace’
return values_.emplace(j, value);
^
make[2]: *** [gtsam/CMakeFiles/gtsam.dir/geometry/triangulation.cpp.o] Error 1
make[1]: *** [gtsam/CMakeFiles/gtsam.dir/all] Error 2
make: *** [all] Error 2
这样的错误,在以下网站发现了解决方法:https://github.com/borglab/gtsam/issues/19
原因是ubuntu14.04安装的TBB的版本太老了,所以需要要么安装新版本,要么在编译阶段不使用TBB网站里面还说可以在gtsam文件夹下的CMakeList.txt文件中修改这句:
option(GTSAM_WITH_TBB "Use Intel Threaded Building Blocks (TBB) if available" OFF)
原本是ON,修改为OFF,但是我发现如果只是修改这个,当你cmake ..之后,它不知道为什么还是会使用TBB,又会导致之前的错误:
所以我除了修改上面的地方,还修改了CMkeList的这里:
这里原本是1,改成了0,也就是无论如何都不会调用TBB。此时再cmake,发现了TBB库,但是被disable了,然后再make一下,就好了。