Skip to content

Solving issues with Ceres

Clemens Kreutz edited this page Apr 28, 2020 · 1 revision

D2D includes the Ceres solver from Google [1] . Ceres is a toolbox of non-linear optimization algorithms. It can be chosen with

ar.config.optimizer = 10;

Compiling Issues#

Ceres will be locally compiled when running arFit for the first time with Ceres. This compilation works an all platforms (Mac, Windows, Linux), but requires a compiler with support for variadic templates:

Visual Studio C++ supported from version 2013

GCC supported from version 4.4

Clang C++ supported from version 2.9

libstdc++ Issues#

When compiling Ceres on Linux with a compiler above the currently supported version of Matlab, you might run into an error when running Ceres which looks like this:

.../libstdc++.so.6: version `GLIBCXX_3.4.x' not found (required by …)

This is due to Matlab preferably using the c++ standard library it has shipped with its distribution. This libstdc++, located in MATLABROOT/sys/os/ is outdated and not the one your compiler used when compiling Ceres.

A fix for this issue is to symbolicly link MATLABs shipped version to the newer one your compiler used. This can be done (on linux) via the commands (in command prompt).

Backup old version

mv MATLABROOT/sys/os/libstdc++.so.6 MATLABROOT/sys/os/libstdc++.so.6.old

Create symbolic link to local libstdc++ folder

ln -s /path/to/compiler/libstdc++.so.6 MATLABROOT/sys/os/libstdc++.so.6

If you don't know where your local libstdc++.so.6 is located just run

locate libstdc++.so.6

An alternate way of fixing this problem is to explicitly tell MATLAB to use the system libstd library. However this has to be done before running matlab with the following command and is required for every run:

env LD_PRELOAD=/path/to/local/libstdc++.so.6 matlab -desktop

[1] Agarwal, S. et al. Ceres Solver. http://ceres-solver.org

Clone this wiki locally