原文链接:https://blog.csdn.net/qq_42760537/article/details/110492460(基础安装步骤)
ceres-solver编译出错。
1,eigen,glog,gflags没有或没安装。
2,gcc和g++不匹配。
上图问题,ceres-solver2.0与g+±5.4不匹配。
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-7
sudo apt-get install g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
sudo update-alternatives --config gcc
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100
sudo update-alternatives --config g++
gcc --version
g++ --version
glog问题;
sudo apt-get install autoconf automake libtool
git clone https://github.com/google/glog
./autogen.sh
./configure
make -j8
sudo make install
git clone https://github.com/gflags/gflags.git
cd gflags
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DGFLAGS_NAMESPACE=gflags ../
make -j4
sudo make install
如果./autogen.sh失败
git clone git://github.com/boboxxd/glog.git
eigen问题。
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
cd eigen-git-mirror
mkdir build
cd build
cmake ..
sudo make install
#安装后,头文件安装在/usr/local/include/eigen3/
#移动头文件
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
最后一步很重要,有些文件编译在/usr/local/include 找不到Eigen出错。
记得看自己eigen版本
gedit /usr/include/eigen3/Eigen/src/Core/util/Macros.h
即版本为3.3.4