# Building the Sparse Bundle Adjustment (SBA) library on OS X

I'm trying to build slam_karto from source, which in turn needs open_karto and sparse_bundle_adjustment

The sparse_bundle_adjustment catkin package has 3 dependencies of interest: liblapack-dev, libblas-dev, and suitesparse OS X comes with (some version of) the first two.

I then tried three different ways of installing SuiteSparse:

• This catkin wrapper: https://github.com/ethz-asl/suitesparse It seemed to work. But then when I tried to build SBA the linker complained that ld: library not found for -lcholmod
• Installing SuiteSparse from source http://faculty.cse.tamu.edu/davis/sui... Got lost in dependencies. clang: error: no such file or directory: '[...]/SuiteSparse/lib/libmetis.dylib'
• Realizing it's available via Homebrew, brew install suite-sparse This got me metis, the dependency above, and installed SuiteSparse. But then, when I tried to compile SBA: fatal error: 'suitesparse/cs.h' file not found I commented out that #include "suitesparse/cs.h" just to see if it can find other headers. It cannot: fatal error: 'suitesparse/cholmod.h' file not found However, these headers are indeed under: /usr/local/Cellar/suite-sparse/4.5.1/include and the seem to be symlinked from/usr/loca/include, e.g., cs.h -> ../Cellar/suite-sparse/4.5.1/include/cs.h

Has anyone been able to build SBA (and SLAM Karto in general) on OS X? Please let me know if you need more information. Thanks in advance!

edit retag close merge delete

Sort by » oldest newest most voted

I realized that the Homebrew formula placed the header files directly under /usr/local/Cellar/suite-sparse/4.5.1/include. That is, there is no /usr/local/Cellar/suite-sparse/4.5.1/include/suitesparse directory. (By contrast, in Ubuntu the headers are placed under /usr/include/suitesparse)

Therefore, by changing the include directives in SBA, specifically in csparse.h, to #include "cs.h" and #include "cholmod.h", I was able to compile the sparse_bundle_adjustment package.

Alternatively, it also works if I create the following symlink myself and keep SBA untouched:

ln -s /usr/local/Cellar/suite-sparse/4.5.1/include /usr/local/include/suitesparse


PS. I was able to build slam_karto too afterwards.

more