Ubuntu16.04安装ceres报错:recipe for target 'bin/system_test' failed以及undefined reference to `google::bas

额,在ubuntu16.04上安装ceres,结果出现了下面的报错,搞了好久没有搞定,非常生气!

不过总之问题最后还是解决了~
简而言之就是这样的

出现问题的原因: gcc和g++的版本太低了()!

解决的方法:

1.把gcc和g++的版本同时设置成为5.0以上的,然后设置gcc切换的方法剧可以参考这个:gcc/g++多版本切换使用
2.再build的文件里输入make clean或者直接把build文件删掉重新建一个
3.再依次执行:cmake .. make sudo make install
然后就成功啦!

这里吐槽一下gcc版本的问题,很多时候需要老版本,很多时候又需要新一点的版本,不知道新版本就不能向前把兼容性做的好一点吗?

cmake..之后的错误“
Did not find METIS library (optional SuiteSparse dependency)
-- Found SuiteSparse: TRUE (found version "4.4.6")
-- Found SuiteSparse 4.4.6, building with SuiteSparse.
-- Found CXSparse: /usr/include/suitesparse (found version "3.1.4")
-- Found CXSparse version: 3.1.4, building with CXSparse.
-- Building without Apple's Accelerate sparse support.
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success
-- Found Gflags: /usr/include
-- Found Google Flags header in: /usr/include, in namespace: google
-- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
-- Failed to find installed glog CMake configuration, searching for glog build directories exported with CMake.
-- Failed to find an installed/exported CMake configuration for glog, will perform search for installed glog components.
-- Found Glog: /usr/include
-- Found Google Log (glog). Assuming glog was built with gflags support as gflags was found. This will make gflags a public dependency of Ceres.
-- Using Ceres threading model: CXX11_THREADS
-- Failed to find Google benchmark library, disabling build of benchmarks.
-- Building Ceres as a static library.
-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.
-- Creating configured Ceres config.h output directory: /home/hri/ThirdParty/ceres-solver-master/build/config/ceres/internal
-- Enabling CERES_USE_EIGEN_SPARSE in Ceres config.h
-- Enabling CERES_NO_ACCELERATE_SPARSE in Ceres config.h
-- Enabling CERES_USE_CXX11_THREADS in Ceres config.h
-- Build the examples.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hri/ThirdParty/ceres-solver-master/build
➜ build make

经过改进之后出现:
[ 94%] Built target circle_fit
Scanning dependencies of target nist
[ 94%] Building CXX object examples/CMakeFiles/nist.dir/nist.cc.o
[ 94%] Linking CXX executable ../bin/nist
[ 94%] Built target nist
Scanning dependencies of target bundle_adjuster
[ 95%] Building CXX object examples/CMakeFiles/bundle_adjuster.dir/bundle_adjuster.cc.o
[ 95%] Building CXX object examples/CMakeFiles/bundle_adjuster.dir/bal_problem.cc.o
[ 95%] Linking CXX executable ../bin/bundle_adjuster
[ 95%] Built target bundle_adjuster
Scanning dependencies of target curve_fitting_c
[ 95%] Building C object examples/CMakeFiles/curve_fitting_c.dir/curve_fitting.c.o
[ 96%] Linking C executable ../bin/curve_fitting_c
[ 96%] Built target curve_fitting_c
Scanning dependencies of target libmv_bundle_adjuster
[ 97%] Building CXX object examples/CMakeFiles/libmv_bundle_adjuster.dir/libmv_bundle_adjuster.cc.o
[ 97%] Linking CXX executable ../bin/libmv_bundle_adjuster
[ 97%] Built target libmv_bundle_adjuster
Scanning dependencies of target libmv_homography
[ 97%] Building CXX object examples/CMakeFiles/libmv_homography.dir/libmv_homography.cc.o
[ 97%] Linking CXX executable ../bin/libmv_homography
[ 97%] Built target libmv_homography
Scanning dependencies of target more_garbow_hillstrom
[ 97%] Building CXX object examples/CMakeFiles/more_garbow_hillstrom.dir/more_garbow_hillstrom.cc.o
[ 98%] Linking CXX executable ../bin/more_garbow_hillstrom
[ 98%] Built target more_garbow_hillstrom
Scanning dependencies of target denoising
[ 98%] Building CXX object examples/CMakeFiles/denoising.dir/denoising.cc.o
[ 98%] Building CXX object examples/CMakeFiles/denoising.dir/fields_of_experts.cc.o
[ 98%] Linking CXX executable ../bin/denoising
[ 98%] Built target denoising
Scanning dependencies of target robot_pose_mle
[ 99%] Building CXX object examples/CMakeFiles/robot_pose_mle.dir/robot_pose_mle.cc.o
[ 99%] Linking CXX executable ../bin/robot_pose_mle
[ 99%] Built target robot_pose_mle
Scanning dependencies of target sampled_function
[ 99%] Building CXX object examples/sampled_function/CMakeFiles/sampled_function.dir/sampled_function.cc.o
[ 99%] Linking CXX executable ../../bin/sampled_function
[ 99%] Built target sampled_function
Scanning dependencies of target pose_graph_2d
[100%] Building CXX object examples/slam/pose_graph_2d/CMakeFiles/pose_graph_2d.dir/pose_graph_2d.cc.o
[100%] Linking CXX executable ../../../bin/pose_graph_2d
[100%] Built target pose_graph_2d
Scanning dependencies of target pose_graph_3d
[100%] Building CXX object examples/slam/pose_graph_3d/CMakeFiles/pose_graph_3d.dir/pose_graph_3d.cc.o
[100%] Linking CXX executable ../../../bin/pose_graph_3d
[100%] Built target pose_graph_3d

但是同时也出现了这个,不知道是什么鬼:

➜ build Adding librt: /usr/lib/x86_64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
zsh: parse error near )'
➜ build -- Did not find METIS library (optional SuiteSparse dependency)
zsh: unknown sort specifier
➜ build -- Found SuiteSparse: TRUE (found version "4.4.6")
zsh: invalid mode specification
➜ build -- Found SuiteSparse 4.4.6, building with SuiteSparse.
zsh: command not found: --
➜ build -- Found CXSparse: /usr/include/suitesparse (found version "3.1.4")
zsh: invalid mode specification
➜ build -- Found CXSparse version: 3.1.4, building with CXSparse.
zsh: command not found: --
➜ build -- Building without Apple's Accelerate sparse support.
quote> -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
quote> -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
quote> -- Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
quote> -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
quote> -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success
quote> -- Found Gflags: /usr/include
quote> -- Found Google Flags header in: /usr/include, in namespace: google
quote> -- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
quote> -- Failed to find installed glog CMake configuration, searching for glog build directories exported with CMake.
quote> -- Failed to find an installed/exported CMake configuration for glog, will perform search for installed glog components.
quote> -- Found Glog: /usr/include
quote> -- Found Google Log (glog). Assuming glog was built with gflags support as gflags was found. This will make gflags a public dependency of Ceres.
quote> -- Using Ceres threading model: CXX11_THREADS
quote> -- Failed to find Google benchmark library, disabling build of benchmarks.
quote> -- Building Ceres as a static library.
quote> -- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.
quote> -- Creating configured Ceres config.h output directory: /home/hri/ThirdParty/ceres-solver-master/build/config/ceres/internal
quote> -- Enabling CERES_USE_EIGEN_SPARSE in Ceres config.h
quote> -- Enabling CERES_NO_ACCELERATE_SPARSE in Ceres config.h
quote> -- Enabling CERES_USE_CXX11_THREADS in Ceres config.h
quote> -- Build the examples.
quote> -- Configuring done
quote> -- Generating done
quote> -- Build files havAdding librt: /usr/lib/x86_64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
quote> -- Did not find METIS library (optional SuiteSparse dependency)
quote> -- Found SuiteSparse: TRUE (found version "4.4.6")
quote> -- Found SuiteSparse 4.4.6, building with SuiteSparse.
quote> -- Found CXSparse: /usr/include/suitesparse (found version "3.1.4")
quote> -- Found CXSparse version: 3.1.4, building with CXSparse.
quote> -- Building without Apple's Accelerate sparse support.
zsh: command not found: --
➜ build -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
zsh: command not found: --
➜ build -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
zsh: command not found: --
➜ build -- Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
zsh: command not found: --
➜ build -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
zsh: command not found: --
➜ build -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success
zsh: command not found: --
➜ build -- Found Gflags: /usr/include
zsh: command not found: --
➜ build -- Found Google Flags header in: /usr/include, in namespace: google
zsh: command not found: --
➜ build -- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
zsh: command not found: --
➜ build -- Failed to find installed glog CMake configuration, searching for glog build directories exported with CMake.
zsh: command not found: --
➜ build -- Failed to find an installed/exported CMake configuration for glog, will perform search for installed glog components.
zsh: command not found: --
➜ build -- Found Glog: /usr/include
zsh: command not found: --
➜ build -- Found Google Log (glog). Assuming glog was built with gflags support as gflags was found. This will make gflags a public dependency of Ceres.
zsh: no matches found: (glog).
➜ build -- Using Ceres threading model: CXX11_THREADS
zsh: command not found: --
➜ build -- Failed to find Google benchmark library, disabling build of benchmarks.
zsh: command not found: --
➜ build -- Building Ceres as a static library.
zsh: command not found: --
➜ build -- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.
zsh: command not found: --
zsh: command not found: defaulting
➜ build -- Creating configured Ceres config.h output directory: /home/hri/ThirdParty/ceres-solver-master/build/config/ceres/internal
zsh: command not found: --
➜ build -- Enabling CERES_USE_EIGEN_SPARSE in Ceres config.h
zsh: command not found: --
➜ build -- Enabling CERES_NO_ACCELERATE_SPARSE in Ceres config.h
zsh: command not found: --
➜ build -- Enabling CERES_USE_CXX11_THREADS in Ceres config.h
zsh: command not found: --
➜ build -- Build the examples.
zsh: command not found: --
➜ build -- Configuring done
zsh: command not found: --
➜ build -- Generating done
zsh: command not found: --

之后继续使用
sudo make install

恩,没错然后奇迹的事情发生了!!!成功啦!!!!
开心!!!

猜你喜欢

转载自blog.csdn.net/Amazingren/article/details/81710883