Ubuntu14.04一切正常,迁移到Ubuntu16.04后编译报错,提示:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: error: static assertion failed:YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);
vip@Alienware-15-R2:~/work/ORB_SLAM2$ ./build.sh
Configuring and building Thirdparty/DBoW2 …
mkdir: 无法创建目录"build": 文件已存在
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vip/work/ORB_SLAM2/Thirdparty/DBoW2/build
[100%] Built target DBoW2
Configuring and building Thirdparty/g2o …
mkdir: 无法创建目录"build": 文件已存在
-- BUILD TYPE:Release
-- Compiling on Unix
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vip/work/ORB_SLAM2/Thirdparty/g2o/build
[100%] Built target g2o
Uncompress vocabulary …
Configuring and building ORB_SLAM2 …
mkdir: 无法创建目录"build": 文件已存在
Build type: Release
-- Using flag -std=c++11.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vip/work/ORB_SLAM2/build
Scanning dependencies of target ORB_SLAM2
[ 3%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o
In file included from /usr/include/eigen3/Eigen/Core:297:0,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/include/eigen3/Eigen/Eigen:1,
from /usr/local/include/pangolin/gl/gl.h:40,
from /usr/local/include/pangolin/pangolin.h:38,
from /home/vip/work/ORB_SLAM2/include/MapDrawer.h:27,
from /home/vip/work/ORB_SLAM2/include/Viewer.h:26,
from /home/vip/work/ORB_SLAM2/include/Tracking.h:28,
from /home/vip/work/ORB_SLAM2/include/LocalMapping.h:27,
from /home/vip/work/ORB_SLAM2/include/LoopClosing.h:25,
from /home/vip/work/ORB_SLAM2/include/Optimizer.h:31,
from /home/vip/work/ORB_SLAM2/src/Optimizer.cc:21:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h: In instantiation of ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Matrix
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:712:27: required from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename Eigen::internal::enable_if<(! Eigen::internal::evaluator_assume_aliasing
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:693:18: required from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Matrix
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:682:32: required from ‘Derived& Eigen::PlainObjectBase
/usr/include/eigen3/Eigen/src/Core/Matrix.h:225:24: required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::operator=(const Eigen::DenseBase
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:367:17: required from ‘Eigen::PermutationMatrix
/home/vip/work/ORB_SLAM2/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:68:18: required from ‘void g2o::LinearSolverEigen
/home/vip/work/ORB_SLAM2/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:195:9: required from ‘void g2o::LinearSolverEigen
/home/vip/work/ORB_SLAM2/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h💯37: required from ‘bool g2o::LinearSolverEigen
/home/vip/work/ORB_SLAM2/src/Optimizer.cc:1244:1: required from here
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);
^
CMakeFiles/ORB_SLAM2.dir/build.make:350: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
error log
问题原因:Eigen3的bug
解决方法:打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,将以下代码
1 template
2 class LinearSolverEigen: public LinearSolver
3 {
4 public:
5 typedef Eigen::SparseMatrix
6 typedef Eigen::Triplet
7 typedef Eigen::PermutationMatrix
改为
1 template
2 class LinearSolverEigen: public LinearSolver
3 {
4 public:
5 typedef Eigen::SparseMatrix
6 typedef Eigen::Triplet
8 typedef Eigen::PermutationMatrix
9 /**
手机扫一扫
移动阅读更方便
你可能感兴趣的文章