Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catkin build updates, some additions for MacOSX build #43

Open
wants to merge 6 commits into
base: catkin
Choose a base branch
from

Conversation

kpykc
Copy link

@kpykc kpykc commented Dec 4, 2014

I tried to make as less intrusion in code as possible (at least no changes in algorithm code), however CMake rules have a lot of changes to make build possible.

Updated package dependencies and build rules:

  • Added cmake_modules ros package to fulfill Eigen dependency, etc.
  • Added cmake find_package rule for GL, X11, etc. Hence removed hardcoded library names/paths.
  • Added toolchain choice if block for MacOSX and some specific CC and CXX compiler flags

Update sources for platform dependent functions:

  • mostly fixes for MacOSX build (__exp10, isnanf)
  • replaced std::chrono::monotonic_clock with std::chrono::steady_clock

Add notes on catkin build:

Main difference seems to be ros-indigo-cmake-modules dependency. For MacOSX build is still not possible, due to clang C++ features coverage and gcc-clang incompatibilities (gcc build code but fails to link to libs built by clang, e.g. roslib, opencv). And it will still need a long howto about ros/brew/mac.

- Added `cmake_modules` ros package to fulfil Eigen, etc.
- Added cmake find_package rule for GL, X11, etc
- Added toolchain choice if block for MacOSX and some specific CC and
CXX compiler flags
Update sources for platform dependent functions:

- mostly fixes for MacOSX build
- replaced `std::chrono::monotonic_clock` with
`std::chrono::steady_clock`
Main difference seems to be `ros-indigo-cmake-modules` dependency.
For MacOSX build is still not possible (notes in CMakeLists.txt) due to
clang C++ features coverage and gcc-clang incompatibilities. And it
will still need a long howto about ros/brew/mac.
@JakobEngel
Copy link
Member

Hi kpykc,

So I take it you are running LSD-SLAM successfully on MacOS? Cool!
I pushed your changes to a new branch catkin-mac, simply because I have no way of exhaustively double-checking them right now - especially the changes to the build system might break it on some other systems, which I would like to avoid.
Best,
Jakob

@kpykc
Copy link
Author

kpykc commented Dec 12, 2014

Hi Jakob,

not exactly running. These are rather changes for build with catkin on Ubuntu 14.04 Trusty/ROS Indigo. But i have also tried to build on MacOSX10.10.1 Yosemite/ROS Indigo. There are only one nifty detail right now with MacOSX build.

In particular there are troubles with code which uses Eigen::aligned_allocator while trying to compile code using clang. On other side gcc from homebrew compiles object files from code using above changes, but it fails to link binaries against libraries built by clang (which are on my system were built from homebrew with clang ). So, later I want try to rebuild homebrew packages with gcc or investigate in depth what exactly clang is missing to build.

My MacOSX environment is like that:

0/kpykc> sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.1
BuildVersion:   14B25
0/kpykc> brew config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 32923f435c7cf93820f434d6bdacf3bfdc3695eb
Last commit: 11 days ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.10.1-x86_64
CLT: 6.1.1.0.1.1416017670
Clang: 6.0 build 600
X11: 2.7.7 => /opt/X11
System Ruby: 2.0.0-481
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.8_2/Frameworks /Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby

@kpykc
Copy link
Author

kpykc commented Dec 12, 2014

But you right, testing is needed, and I left to much comments in CMakeLists.txt. So, they are cluttering the file a bit. May be also toolchain configuration better to move to separate .cmake file.

- Removed toolchain selection for Mac OSX: use default compiler - `clang`
- Add `X11` libs and headers dependency for `lsd_slam_core` library target
- Correct const parameter in `trackingFailed` multi-map in `Frame.h`
- Removed `std::vector` parameter `Eigen::aligned_allocator<FramePoseStruct*>`,
  it seems to be unused appendix, but still breakes build due to being of different
  type than first argument, and clang is strict in this case.
@kpykc
Copy link
Author

kpykc commented Dec 14, 2014

I have fixed build with clang on Mac OSX it now builds with few warnings. The problem was, that clang more strict than gcc. It took only few changes to source:

I removed Eigen::aligned_allocator<FramePoseStruct*> in definition below, as it not used anywhere

 std::vector< KFConstraintStruct* > newEdgeBuffer;

And changed const here:

 std::unordered_multimap< Frame*, Sim3, std::hash<Frame*>, std::equal_to<Frame*>,
    Eigen::aligned_allocator< std::pair<Frame* const,Sim3 > > > trackingFailed;

But, I still have some problem with live_slam node, i have tried to run it using macbook camera with pinhole calibration example (just to check that it's working), and it seems that visualization thread hangs, but code runs, not crashing. It may be due to resolution was different than recommended.

@nyotis
Copy link

nyotis commented Dec 22, 2014

Hi kpykc,

can you confirm a successful build on OS X Yosemite?

@kpykc
Copy link
Author

kpykc commented Dec 22, 2014

Hi,

yes it builds.

@phaile2
Copy link

phaile2 commented Apr 5, 2015

Hi,
When trying catkin_make --pkg lsd_slam_core the build always fails. I keep getting an error that ‘CV_GRAY2RGB’ was not declared in this scope for multiple files. Any clues on why this is? I've been trying to get this to run all day and I also tried building using the regular ros workstation but it did not work as well. I'm really new to linux, SLAM and cv in general. Any help would be greatly appreciated.

@kpykc
Copy link
Author

kpykc commented Apr 7, 2015

I guess you have some problems with ROS cv_bridge or
OpenCV installation or with visibility of their header files.

Yous should check if all dependencies are installed.

@phaile2
Copy link

phaile2 commented Apr 19, 2015

That seemed to be the problem. Thanks, and cool work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants