Create standalone gtsam toolbox

Issue #326 resolved
Tal Regev created an issue

========= EDIT ==========
I understand better the problem, I discover when i run cmake-gui, configure and generate it automatic switch to shared boost. I will ask again the question.
========= EDIT ==========

Hi, currently I want to compile gtsam toolbox for matlab that will be standalone,
like you do here
I am using ubuntu 14.04 with gcc 4.9 boost 1.54 (default in ubuntu 14.04) I compile the branch fix/boost158gtsam3 (gtsam 3.2.1). I compile with this flags:

CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$PREFIX -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_UNSTABLE=OFF -DCMAKE_BUILD_TYPE=Release"
CMAKE_FLAGS="$CMAKE_FLAGS -DGTSAM_INSTALL_MATLAB_TOOLBOX=ON -DMEX_COMMAND=/usr/local/MATLAB/$MATLAB_VER/bin/mex -DGTSAM_MEX_BUILD_STATIC_MODULE=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_CXX_FLAGS=-fPIC -DGTSAM_BUILD_MEX_BINARY_FLAGS=-fPIC"

When I compile I get this errors:

/home/talregev/ANPL/code/3rdparty/gtsam-3.2.1/build-tal/wrap/gtsam/gtsam_wrapper.cpp: In function void gtsamGaussianFactorGraph_eliminateMultifrontal_769(int, mxArray**, int, const mxArray**):
/home/talregev/ANPL/code/3rdparty/gtsam-3.2.1/build-tal/wrap/gtsam/gtsam_wrapper.cpp:9536:57: error: class boost::shared_ptr<gtsam::GaussianBayesTree> has no member named clone
   out[0] = wrap_shared_ptr(obj->eliminateMultifrontal().clone(),"gtsam.GaussianBayesTree", true);
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libboost_serialization.a(basic_iarchive.o): relocation R_X86_64_32S against `_ZTVN5boost7archive6detail14basic_iarchiveE' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libboost_serialization.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

When I change the flag -DBoost_USE_STATIC_LIBS=OFF it compile.

How I can compile gtsam and gtsam toolbox with static boost?

Comments (4)

  1. Tal Regev reporter

    After many tries and long search on the internet. i finally got it. I was need to recompile boost with -fPIC. (if just small text was say 'recompile static library with -fPIC' it was help). Finally, i compile and it work!

  2. Log in to comment