raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.41k stars 4.7k forks source link

Cannot build on macOS High Sierra 10.13 #445

Open dimitris64bit opened 7 years ago

dimitris64bit commented 7 years ago

Is there anyone who has managed to do it? Any recommendations?

elwin0214 commented 6 years ago

I build it successfully.

  1. the usleep is undefine ,you should include <unistd.h>
  2. replace the <tr/memory> with <memory> including some container class in c++11, and remove the word "tr" in the namsespace.
  3. replace the suffix of the *.so file with 'dylib' in CmakeLists.txt
  4. in the "include/LoopClosing.h" file , replace Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose; with Eigen::aligned_allocator<std::pair<KeyFrame * const, g2o::Sim3> > > KeyFrameAndPose;
matheecs commented 6 years ago

Thanks! Add

  1. replace #include<stdint-gcc.h> with #include<stdint.h>
PapaMadeleine2022 commented 5 years ago

get error:

[  3%] Linking CXX shared library ../lib/libORB_SLAM2.dylib
Undefined symbols for architecture x86_64:
  "_glBegin", referenced from:
      ORB_SLAM2::MapDrawer::DrawMapPoints() in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glBlendFunc", referenced from:
      ORB_SLAM2::Viewer::Run() in Viewer.cc.o
  "_glClear", referenced from:
      ORB_SLAM2::Viewer::Run() in Viewer.cc.o
  "_glClearColor", referenced from:
      ORB_SLAM2::Viewer::Run() in Viewer.cc.o
  "_glColor3f", referenced from:
      ORB_SLAM2::MapDrawer::DrawMapPoints() in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glColor4f", referenced from:
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
  "_glEnable", referenced from:
      ORB_SLAM2::Viewer::Run() in Viewer.cc.o
  "_glEnd", referenced from:
      ORB_SLAM2::MapDrawer::DrawMapPoints() in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glLineWidth", referenced from:
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glMultMatrixd", referenced from:
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glMultMatrixf", referenced from:
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
  "_glPointSize", referenced from:
      ORB_SLAM2::MapDrawer::DrawMapPoints() in MapDrawer.cc.o
  "_glPopMatrix", referenced from:
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glPushMatrix", referenced from:
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
  "_glVertex3f", referenced from:
      ORB_SLAM2::MapDrawer::DrawMapPoints() in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawKeyFrames(bool, bool) in MapDrawer.cc.o
      ORB_SLAM2::MapDrawer::DrawCurrentCamera(pangolin::OpenGlMatrix&) in MapDrawer.cc.o
ld: symbol(s) not found for architecture x86_64

adding "-framework OpenGL" to target_link_libraries in CmakeLists.txt solve above error.