yunchih / ORB-SLAM2-GPU2016-final

http://yunchih.github.io/ORB-SLAM2-GPU2016-final/
Other
326 stars 150 forks source link

Compilation error on Eigen3 #9

Open alexge233 opened 6 years ago

alexge233 commented 6 years ago

Hi,

Thanks for the code! Sadly it fails to build with an Eigen static assertion error:

[ 50%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o
In file included from /usr/include/eigen3/Eigen/Core:297:0,
                 from /usr/local/include/pangolin/gl/gl.h:39,
                 from /usr/local/include/pangolin/pangolin.h:33,
                 from /home/zuperath/code/orb-slam2-gpu/include/MapDrawer.h:27,
                 from /home/zuperath/code/orb-slam2-gpu/include/Viewer.h:26,
                 from /home/zuperath/code/orb-slam2-gpu/include/Tracking.h:28,
                 from /home/zuperath/code/orb-slam2-gpu/include/LocalMapping.h:27,
                 from /home/zuperath/code/orb-slam2-gpu/include/LoopClosing.h:25,
                 from /home/zuperath/code/orb-slam2-gpu/include/Optimizer.h:27,
                 from /home/zuperath/code/orb-slam2-gpu/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<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:27:   required from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename Eigen::internal::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:18:   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:32:   required from ‘Derived& Eigen::PlainObjectBase<Derived>::_set(const Eigen::DenseBase<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:24:   required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::operator=(const Eigen::DenseBase<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:17:   required from ‘Eigen::PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>& Eigen::PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>::operator=(const Eigen::PermutationBase<OtherDerived>&) [with Other = Eigen::PermutationMatrix<-1, -1, long int>; int SizeAtCompileTime = -1; int MaxSizeAtCompileTime = -1; _StorageIndex = int]’
/home/zuperath/code/orb-slam2-gpu/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:68:18:   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>::PermutationMatrix = Eigen::PermutationMatrix<-1, -1, long int>]’
/home/zuperath/code/orb-slam2-gpu/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/zuperath/code/orb-slam2-gpu/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:100:37:   required from ‘bool g2o::LinearSolverEigen<MatrixType>::solve(const g2o::SparseBlockMatrix<MatrixType>&, double*, double*) [with MatrixType = Eigen::Matrix<double, 7, 7, 0, 7, 7>]’
/home/zuperath/code/orb-slam2-gpu/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:378: 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
ashishbhatti commented 6 years ago

https://github.com/raulmur/ORB_SLAM2/issues/202#issuecomment-263280081 This resolved this problem in my case. I had other issues after that.

Linking CXX shared library lib/libORB_SLAM2.so
/usr/bin/ld: cannot find -lnvToolsExt
collect2: error: ld returned 1 exit status
CMakeFiles/ORB_SLAM2.dir/build.make:1957: recipe for target 'lib/libORB_SLAM2.so' failed
make[2]: *** [lib/libORB_SLAM2.so] 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
Warsin commented 6 years ago

This resolved this problem in my case. I had other issues after that.

Linking CXX shared library lib/libORB_SLAM2.so /usr/bin/ld: cannot find -lnvToolsExt collect2: error: ld returned 1 exit status CMakeFiles/ORB_SLAM2.dir/build.make:1957: recipe for target 'lib/libORB_SLAM2.so' failed make[2]: [lib/libORB_SLAM2.so] 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

did you have solved it?

Halcao commented 5 years ago

This resolved this problem in my case. I had other issues after that.

Linking CXX shared library lib/libORB_SLAM2.so /usr/bin/ld: cannot find -lnvToolsExt collect2: error: ld returned 1 exit status CMakeFiles/ORB_SLAM2.dir/build.make:1957: recipe for target 'lib/libORB_SLAM2.so' failed make[2]: [lib/libORB_SLAM2.so] 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

did you have solved it?

You should find libnvToolsExt.so and copy/link it to your library path. In my case, the shared library path is /usr/local/cuda-9.0/targets/aarch64-linux/lib/libnvToolsExt.so

mindmad commented 2 years ago

Hi @yunchih , @Halcao . I had a similar error with eigen , here is the error log:

-- Configuring incomplete, errors occurred!
See also "/home/mad/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log".
See also "/home/mad/ORB_SLAM2/build/CMakeFiles/CMakeError.log".
[  3%] Linking CXX shared library ../lib/libORB_SLAM2.so
/usr/bin/ld: cannot find -lEigen3::Eigen
collect2: error: ld returned 1 exit status
CMakeFiles/ORB_SLAM2.dir/build.make:601: recipe for target '../lib/libORB_SLAM2.so' failed
make[2]: *** [../lib/libORB_SLAM2.so] Error 1
CMakeFiles/Makefile2:252: 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

I tried with all the solutions in this issue it did not work any help how to solve this error. thank you in advance.

yunchih commented 2 years ago

Did you follow this?

mindmad commented 2 years ago

Did you follow this?

thank you for your reply. I found that Pangolin version was the problem I installed 0.5 version instead and it solved the problem.