安裝ceres_solver

在slam書第7章練習時,提示 csparse缺失,所以安裝ceres_solver, g2o 等來嘗試解決

安裝ceres_solver 

# Cmake
$ sudo apt-get install cmake
# google-glog + gflags
$ sudo apt-get install libgoogle-glog-dev
# BLAS & LAPAC
$ sudo apt-get install libatlas-base-dev
# Eigen3  已用安裝包安裝過
$ sudo apt-get install libeigen3-dev
# SuiteSparse和CXSparse(可選)
# - 如果您希望將Ceres構建爲*static*庫(默認),則可以在Ubuntu主包repository中使用SuiteSparse包
#20200220採用了這個命令 後續需要的話再修改
$ sudo apt-get install libsuitesparse-dev
# - 但是,如果您要將Ceres構建爲* shared *庫,則必須添加以下PPA:
$ sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687
$ sudo apt-get update
$ sudo apt-get install libsuitesparse-dev

 

成功完成,不再提示csparse問題

問題:如果需要shared庫,會不會報錯?

[ 40%] Linking CXX executable pose_estimation_3d2d CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o: In function `g2o::LinearSolverCSparse<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solvePattern(g2o::SparseBlockMatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&)': pose_estimation_3d2d.cpp:(.text._ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE12solvePatternERNS_17SparseBlockMatrixINS2_IdLin1ELin1ELi0ELin1ELin1EEEEERKSt6vectorISt4pairIiiESaISB_EERKNS5_IS3_EE[_ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE12solvePatternERNS_17SparseBlockMatrixINS2_IdLin1ELin1ELi0ELin1ELin1EEEEERKSt6vectorISt4pairIiiESaISB_EERKNS5_IS3_EE]+0xd8): undefined reference to `g2o::csparse_extension::cs_chol_workspace(cs_di_sparse const*, cs_di_symbolic const*, int*, double*)' CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o: In function `g2o::LinearSolverCSparse<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solveBlocks(double**&, g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&)': pose_estimation_3d2d.cpp:(.text._ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE11solveBlocksERPPdRKNS_17SparseBlockMatrixIS3_EE[_ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE11solveBlocksERPPdRKNS_17SparseBlockMatrixIS3_EE]+0xfd): undefined reference to `g2o::csparse_extension::cs_chol_workspace(cs_di_sparse const*, cs_di_symbolic const*, int*, double*)' CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o: In function `g2o::LinearSolverCSparse<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solve(g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&, double*, double*)': pose_estimation_3d2d.cpp:(.text._ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE5solveERKNS_17SparseBlockMatrixIS3_EEPdS9_[_ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE5solveERKNS_17SparseBlockMatrixIS3_EEPdS9_]+0xe8): undefined reference to `g2o::csparse_extension::cs_cholsolsymb(cs_di_sparse const*, double*, cs_di_symbolic const*, double*, int*)' pose_estimation_3d2d.cpp:(.text._ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE5solveERKNS_17SparseBlockMatrixIS3_EEPdS9_[_ZN3g2o19LinearSolverCSparseIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE5solveERKNS_17SparseBlockMatrixIS3_EEPdS9_]+0x1ea): undefined reference to `g2o::csparse_extension::writeCs2Octave(char const*, cs_di_sparse const*, bool)' collect2: error: ld returned 1 exit status CMakeFiles/pose_estimation_3d2d.dir/build.make:112: recipe for target 'pose_estimation_3d2d' failed make[2]: *** [pose_estimation_3d2d] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/pose_estimation_3d2d.dir/all' failed make[1]: *** [CMakeFiles/pose_estimation_3d2d.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

 

 

重新安裝 ceres_solver 依然報錯,安裝g2o後變好。

需要重新安裝 重新安裝 sudo apt-get install libsuitesparse-dev

參考https://blog.csdn.net/qq_32320399/article/details/79838609

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章