undefined reference to `ceres::Solve(ceres::Solver::Options const&, ceres::Problem*,
问题描述:
软件安装编译时,出现以下问题,是ceres库和glog库有问题
undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `ceres::Solver::Summary::FullReport[abi:cxx11]() const'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `ceres::Problem::AddResidualBlock(ceres::CostFunction*, ceres::LossFunction*, double*)'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `ceres::Solver::Summary::Summary()'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `ceres::Problem::~Problem()'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `ceres::Problem::AddParameterBlock(double*, int)'
//usr/lib/libblas.so.3: undefined reference to `gotoblas'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `google::base::CheckOpMessageBuilder::ForVar2()'
../../../Linux-x86_64/libaliceVision_multiview.so.2.2: undefined reference to `ceres::Solve(ceres::Solver::Options const&, ceres::Problem*, ceres::Solver::Summary*)'
于是安装gflags,glog,suitsparse,安装后重新编译发现还是有问题,于是写了一个简单的测试ceres库的代码,可以正常cmake和编译,但执行程序时有以下报错
./ceres_stitchedimage: error while loading shared libraries: libgflags.so.2.2: cannot open shared object file: No such file or directory
加载不到动态库,在电脑内搜索该库,发现并没有该动态库,只有gflag的静态库,于是重新编译安装gflags。
解决方法:
编译安装gflags,降低ceres版本即可编译成功