Ubuntu14.04 all normal, migrated to Ubuntu16.04 after compiling error, prompt:
/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);
[Email protected] the-r2:~/work/orb_slam2$./build.SHConfiguring and building ThirdParty/DBoW2 ...mkdir: Unable to create directory"Build": File already exists--Configuring Done--generating Done--Build files has been written to:/home/vip/work/orb_slam2/thirdparty/dbow2/build[ -%] Built target dbow2configuring and building thirdparty/g2o ...mkdir: Unable to create directory"Build": File already exists--BUILD type:release--Compiling on Unix--Configuring Done--generating Done--Build files has been written to:/home/vip/work/orb_slam2/thirdparty/g2o/build[ -%] Built target g2ouncompress vocabulary ... Configuring and building Orb_slam2 ...mkdir: Unable to create directory"Build": File already exists build Type:release--Using flag-std=c++ One.--Configuring Done--generating Done--Build files has been written to:/home/vip/work/orb_slam2/buildscanning dependencies of target orb_slam2[3%] Building CXXObjectCmakefiles/orb_slam2.dir/src/optimizer.cc. OInfileIncluded 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: +, from/usr/local/include/pangolin/pangolin.h: -, from/home/vip/work/orb_slam2/include/mapdrawer.h: -, from/home/vip/work/orb_slam2/include/viewer.h: -, from/home/vip/work/orb_slam2/include/tracking.h: -, from/home/vip/work/orb_slam2/include/localmapping.h: -, from/home/vip/work/orb_slam2/include/loopclosing.h: -, from/home/vip/work/orb_slam2/include/optimizer.h: to, from/home/vip/work/orb_slam2/src/optimizer.cc: +:/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<int, -1,1>; SRC = eigen::matrix<Long int, -1,1,0, -1,1>; Func = eigen::internal::assign_op<int>] ':/usr/include/eigen3/eigen/src/core/assignevaluator.h:712: -: Required from ' void eigen::internal::call_assignment (dst&, const src&, const Func&, TypeName Eigen::intern al::enable_if< (! Eigen::internal::evaluator_assume_aliasing<src>::value), Void*>::type) [With Dst = Eigen::Matrix<int, -1,1>; SRC = eigen::matrix<Long int, -1,1,0, -1,1>; Func = eigen::internal::assign_op<int>; TypeName eigen::internal::enable_if< (! Eigen::internal::evaluator_assume_aliasing<src>::value), Void*>::type = void*] '/usr/include/eigen3/eigen/src/core/assignevaluator.h:693: -: Required from ' void eigen::internal::call_assignment (dst&, const src&) [With Dst = eigen::matrix<int, -1,1>; SRC = eigen::matrix<Long int, -1,1,0, -1,1>] '/usr/include/eigen3/eigen/src/core/plainobjectbase.h:682: +: Required from ' derived& Eigen::P lainobjectbase<derived>::_set (const Eigen::D ensebase<otherderived >&) [With otherderived = eigen::matrix<Long int, -1,1,0, -1,1>; Derived = eigen::matrix<int, -1,1>] '/usr/include/eigen3/eigen/src/core/matrix.h:225: -: Required from ' Eigen::matrix<_scalar, _rows, _cols, _options, _maxrows, _maxcols>& eigen::matrix<_scalar , _rows, _cols, _options, _maxrows, _maxcols>::operator= (const Eigen::D ensebase<otherderived>&) [with otherderived = eigen::matrix<Long int, -1,1,0, -1,1>; _scalar =int;int_rows =-1;int_cols =1;int_options =0;int_maxrows =-1;int_maxcols =1] '/usr/include/eigen3/eigen/src/core/permutationmatrix.h:367: -: Required from ' Eigen::P ermutationmatrix<sizeatcompiletime, Maxsizeatcompiletime, indextype>& Eigen:: Permutationmatrix<sizeatcompiletime, Maxsizeatcompiletime, indextype>::operator= (const Eigen:: permutationbase<otherderived>&) [With other = Eigen::P ermutationmatrix<-1, -1,Long int>;intSizeatcompiletime =-1;intMaxsizeatcompiletime =-1; _storageindex =int] '/home/vip/work/orb_slam2/thirdparty/g2o/g2o/solvers/linear_solver_eigen.h: the: -: Required from ' void G2o::linearsolvereigen<matrixtype>::choleskydecomposition:: Analyzepatternwithpermutation (g2o::linearsolvereigen<matrixtype>::sparsematrix&, const permutationmatrix&) [With Matrixtype = eigen::matrix<Double,7,7,0,7,7>; G2o::linearsolvereigen<matrixtype>::sparsematrix = eigen::sparsematrix<Double,0>; G2o::linearsolvereigen<matrixtype>::P Ermutationmatrix = Eigen::P ermutationmatrix<-1, -1,Long int>] '/home/vip/work/orb_slam2/thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:195:9: Required from ' void G2o::linearsolvereigen<matrixtype>::computesymbolicdecomposition (const G2O:: sparseblockmatrix<matrixtype>&) [With Matrixtype = eigen::matrix<Double,7,7,0,7,7>] '/home/vip/work/orb_slam2/thirdparty/g2o/g2o/solvers/linear_solver_eigen.h: -:Panax Notoginseng: Required from 'BOOLG2o::linearsolvereigen<matrixtype>::solve (const g2o::sparseblockmatrix<matrixtype>&,Double*,Double*) [With matrixtype = eigen::matrix<Double,7,7,0,7,7>] '/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: -: recipe forTarget'CMAKEFILES/ORB_SLAM2.DIR/SRC/OPTIMIZER.CC.O'failed Make[2]: * * * [CMAKEFILES/ORB_SLAM2.dir/src/optimizer.cc. O] Error1Cmakefiles/makefile2: the: recipe forTarget'Cmakefiles/orb_slam2.dir/all'failed Make[1]: * * * [CMAKEFILES/ORB_SLAM2.dir/ALL] Error2Makefile: the: recipe forTarget' All'failed Make: * * * [ALL] Error2
error LogProblem reason: Eigen3 's bug resolution method:Open Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h, and the following code
1Template <typename matrixtype>2 classLinearsolvereigen: PublicLinearsolver<matrixtype>3 {4 Public:5typedef eigen::sparsematrix<Double, eigen::colmajor>Sparsematrix;6typedef eigen::triplet<Double>Triplet;7 typedef Eigen::P Ermutationmatrix<eigen::D ynamic, Eigen::D ynamic,Sparsematrix::index> Permutationmatrix;
Switch
1Template <typename matrixtype>2 classLinearsolvereigen: PublicLinearsolver<matrixtype>3 {4 Public:5typedef eigen::sparsematrix<Double, eigen::colmajor>Sparsematrix;6typedef eigen::triplet<Double>Triplet;8typedef Eigen::P Ermutationmatrix<eigen::D ynamic, Eigen::D ynamic,int>Permutationmatrix;9 /**
ORB_SLAM2 Ubuntu16.04 Compilation Error