ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

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

asked 2016-04-17 11:49:32 -0500

spmaniato gravatar image

updated 2016-04-17 13:42:49 -0500

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: 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 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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-17 14:19:21 -0500

spmaniato gravatar image

updated 2016-04-17 14:25:08 -0500

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.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-04-17 11:49:32 -0500

Seen: 1,435 times

Last updated: Apr 17 '16