1.Download the ceres source code
git clone https://ceres-solver.googlesource.com/ceres-solver
2.Dependencies
# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev
# BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse and CXSparse (optional)
# - If you want to build Ceres as a *static* library (the default)
# you can use the SuiteSparse package in the main Ubuntu package
# repository:
sudo apt-get install libsuitesparse-dev
# - However, if you want to build Ceres as a *shared* library, you must
# add the following PPA:
sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687
sudo apt-get update
sudo apt-get install libsuitesparse-dev
3.Compile and Installation
Enter the ceres download path.
tar zxf ceres-solver-XXX
mkdir build
cd build/
cmake ..
make
sudo make install
4. Issues
CMake Error at CMakeLists.txt:243 (find_package):
Could not find a configuration file for package "Eigen3" that is compatible
with requested version "3.3".
The following configuration files were considered but not accepted:
/usr/lib/cmake/eigen3/Eigen3Config.cmake, version: unknown
Solution: Reinstall the eigen3 which version is later than 3.3.3, such as 3.3.4, then re-install the ceres.
git clone https://github.com/eigenteam/eigen-git-mirror
cd eigen-git-mirror
mkdir build
cd build
cmake ..
sudo make install
#after installation, the header file will be in /usr/local/include/eigen3/