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

Compiling on OSX Mavericks 10.9.3 with clang and No-ROS (Success!) #16

Open
b4silio opened this issue Jun 17, 2014 · 11 comments
Open

Compiling on OSX Mavericks 10.9.3 with clang and No-ROS (Success!) #16

b4silio opened this issue Jun 17, 2014 · 11 comments

Comments

@b4silio
Copy link

b4silio commented Jun 17, 2014

I finally managed to compile rpg_svo successfully after several hours of headbanging (due in no small part to my ineptitude with CMake)

I followed the instruction on https://github.com/uzh-rpg/rpg_svo/wiki/Installation:-Plain-CMake-(No-ROS). What follow are the issues I encountered along the way, and how I solved them.

Eigen 3

  • Could not use apt-get but used homebrew (brew install eigen). However, simply downloading Eigen and putting it somewhere the system will find it also works (need to change CMakeLists.txt accordingly though)

Sophus - Lie groups

  • Changed Code in sophus/so2.cpp (clang was complaining that error: expression is not assignable)
    unit_complex = Complexd(1.,0.);_
    instead of
    unit_complex.real() = 1.;_
    unit_complex.imag() = 0.;_
    solves the issue.

Fast - Corner Detector

  • Taken out -Wno-unused-but-set-variable (not liked by clang) from CMakeLists.txt
  • Seems to not find the correct symbols in the OpenCV libraries at linking time (osx llvm / c+x11 problem?). I recompiled OpenCV (2.4.9) and both Fast and vikit_common now compile fine. (I probably had GCC libraries)

Compiling G2O (optional)

  • skipped

vikit_common

  • Same problem with OpenCV (unrecognised symbols at linking time)
  • The project does not generate a cmake config file for find_package (which is a problem for rpg_svo)

rpg_svo

  • find_package() cannot find vikit_common because of missing config file. manually added the path to the library
    set(vikit_common_LIBRARIES "/Users/basilio/Code/RPG_SVO/rpg_vikit/vikit_common/lib/libvikit_common.dylib")
    as well as copying the vikit include folder in svo (the lazy alternative to actually doing it properly in CMake)
  • Warnings are messing up compilation on clang, took out -Werror and -Wno-unused-but-set-variable and -funsafe-remove-loops from CMakeLists.txt
  • Cannot find boost::system::system_category(). Added the boost_system library in CMakeLists.txt: set(boost_LIBRARIES "/opt/local/lib/libboost_system-mt.dylib")
  • ERROR: test_utils.h:l22
    #include < ros/package.h >
    needs to be commented away if you’re not using ROS
  • ERROR: test_depth_filter.cpp:l124+l132
    boost::make_shared< svo::Frame > (cam, img, 0.0);_
    adding
    #include < boost/make_shared.hpp >
    #include < boost/shared_ptr.hpp >
    Solved the issue

Running the tests
The tests work fine, as does test_pipeline on a custom dataset!

p.s. sorry for the bad formatting, not a guru with Markdown!
p.p.s posting this as an Issue because I didn't know where else to put it!

@cfo
Copy link
Collaborator

cfo commented Jun 18, 2014

Hi,
thanks for your feedback!
I fixed the last two ERRORS and added a cmake config file for rpg_vikit. On my computer it is found anyway so I couldn't really test it but it should work..
I am not sure what we can do about the other things. Maybe I will just add a link to this page in the Wiki.
Best,
Christian

@vinben
Copy link

vinben commented Jun 20, 2014

That's another issue related to Mac Mavericks (Xcode 5.1). When I compile svo, the compiler gives such message:

[  4%] Building CXX object CMakeFiles/svo.dir/src/frame_handler_mono.cpp.o
clang: error: unknown argument: '-funsafe-loop-optimizations' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make[2]: *** [CMakeFiles/svo.dir/src/frame_handler_mono.cpp.o] Error 1

It seems that the compiler with the new xcode is quite restrictive when it comes to warnings. I guess that may need additional ARCHFLAGS but I don't know which one is proper.

@jmtatsch
Copy link

isnanf() is not defined on OSX, could this:
if(isnanf(norm_scale))
just be changed to:
if(isnan(norm_scale))
without major performance hits?

@cfo
Copy link
Collaborator

cfo commented Jun 30, 2014

i changed it to std::isnan(). (http://en.cppreference.com/w/cpp/numeric/math/isnan)

@jmtatsch
Copy link

jmtatsch commented Jul 1, 2014

Thanks!

@kubark42
Copy link

Very similar experience to @b4silio. Kudos to him for finding the workarounds!

This is on OSX 10.9.5, using XCode 6.0.1.

Follow all directions in https://github.com/uzh-rpg/rpg_svo/wiki/Installation:-Plain-CMake-(No-ROS), with the following modifications:

Eigen

brew install eigen is the only command necessary. (Don't have brew? Install it here.)

Sophus

In sophus/so2.cpp replace:

unit_complex_.real() = 1.; 
unit_complex_.imag() = 0.;

with:

unit_complex_ = Complexd(1.,0.);

(Could the SVO maintainers upgrade to using latest Sophus? It compiles correctly on OSX.)

Fast

(No OpenCV problems similar to those reported by @b4silio.)

In CMakeLists.txt, remove -Wno-unused-but-set-variable

(Could the SVO maintainers make this flag compiler dependent? Clang fails due to its presence.)

G2O (optional)

skipped

Vikit

(No OpenCV problems similar to those reported by @b4silio.)
(No find_package() problems similar to those reported by @b4silio.)

RPG-SVO

In CMakeLists.txt, remove -Wno-unused-but-set-variable

(Could the SVO maintainers make this flag compiler dependent? Clang fails due to its presence.)

Running the tests

The tests work fine, as does test_pipeline on a custom dataset!

@unisethenry
Copy link

Thanks for your experience sharing (especially the complex number part in Sophus)! I can compile the source smoothly on OS X 10.10.2 with Xcode 6.1.1!

@pranny
Copy link

pranny commented Apr 23, 2015

On an OS X 10.10.3 with Xcode 6.3.1, I have Sophus installed, and the files are present at /usr/local/include/sophus. All the tests for Sophus pass. The tail of make install for Sophus goes like

Install the project...
/usr/local/Cellar/cmake/3.2.1/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
-- Up-to-date: /usr/local/include/sophus
-- Up-to-date: /usr/local/include/sophus/rxso3.hpp
-- Up-to-date: /usr/local/include/sophus/se2.hpp
-- Up-to-date: /usr/local/include/sophus/se3.hpp
-- Up-to-date: /usr/local/include/sophus/sim3.hpp
-- Up-to-date: /usr/local/include/sophus/so2.hpp
-- Up-to-date: /usr/local/include/sophus/so3.hpp
-- Up-to-date: /usr/local/include/sophus/sophus.hpp
-- Up-to-date: /usr/local/include/sophus/tests.hpp

Now when I try to build rpg_svo/svo the output of cmake .. from build dir

MACOSX_RPATH is not specified for the following targets:

   svo

Here is the output of make

[  4%] Building CXX object CMakeFiles/svo.dir/src/frame_handler_mono.cpp.o
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
In file included from /Users/pranav/workspace/rpg_svo/svo/src/frame_handler_mono.cpp:18:
In file included from /Users/pranav/workspace/rpg_svo/svo/include/svo/frame_handler_mono.h:22:
In file included from /Users/pranav/workspace/rpg_svo/svo/include/svo/frame_handler_base.h:26:
/Users/pranav/workspace/rpg_svo/svo/include/svo/global.h:29:10: fatal error: 'sophus/se3.h' file not found
#include <sophus/se3.h>
         ^
2 warnings and 1 error generated.
make[2]: *** [CMakeFiles/svo.dir/src/frame_handler_mono.cpp.o] Error 1
make[1]: *** [CMakeFiles/svo.dir/all] Error 2
make: *** [all] Error 2

I can't seem to find out the solution for this. What could be causing it?

@Dabrant
Copy link

Dabrant commented Apr 26, 2015

@pranny I'm pretty sure you just forgot to checkout the a621ff commit of Sophus as mentioned in the wiki page for the install instructions https://github.com/uzh-rpg/rpg_svo/wiki/Installation:-Plain-CMake-(No-ROS). This will give you the .h files instead of the .hpp files in the current master branch. That seems to be what's giving you the file not found fatal error.

@weiminshen99
Copy link

Hi, Everyone,

Thanks for the helpful posts for running SVO on Mac without ROS. I have successfully compiled the code and all tests seem work except ./test_depth_filter. It causes errors in two places listed below. Please help me and let me know how to fix the problem. Thanks!

======= Problem 1 ============
When I run ./test_pipeline, it processed frames 2 thru 185, and then prints the following error:
[INFO] DepthFilter stop thread invoked.
[INFO] DepthFilter interrupt and join thread...
[INFO] DepthFilter destructed.
test_pipeline(81278,0x7fffa1afb380) malloc: *** error for object 0x4d0023004d000b: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

======== Problem 2 =========
When I run ./test_depth_filter, it runs into the following error:
RUN EXPERIMENT: read 187 dataset entries.
reading image: '/Users/weiminshen99/GitHub/SVO/Datasets/sin2_tex2_h1_v8_d/img/frame_000002_0.png'
Assertion failed: ((internal::UIntPtr(array) & (31)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"), function plain_array, file /usr/local/Cellar/eigen/3.3.4/include/eigen3/Eigen/src/Core/DenseStorage.h, line 128.
Abort trap: 6

@Junxen
Copy link

Junxen commented Sep 5, 2018

@weiminshen99, have you solved Problem 1 yet? I have the exactly the same error.

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

No branches or pull requests

10 participants