PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.46k stars 13.5k forks source link

Gazebo SITL doesn't find Eigen anymore on Mac #4195

Closed AndreasAntener closed 8 years ago

AndreasAntener commented 8 years ago

@LorenzMeier @nicolaerosia after the Eigen dependency change to find_package it doesn't work anymore for me on mac, not sure why. Eigen is installed via brew.

CMake Error at CMakeLists.txt:13 (find_package):
  By not providing "FindEigen.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Eigen", but
  CMake did not find one.

  Could not find a package configuration file provided by "Eigen" with any of
  the following names:

    EigenConfig.cmake
    eigen-config.cmake

  Add the installation prefix of "Eigen" to CMAKE_PREFIX_PATH or set
  "Eigen_DIR" to a directory containing one of the above files.  If "Eigen"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
AndreasAntener commented 8 years ago

Also the optical flow and sensors plugin won't compile:

      'gazebo::sensors::RaySensor'; did you mean 'GetLaserShape'?
  this->parentSensor->LaserShape()->DisconnectNewLaserScans(
                      ^~~~~~~~~~
                      GetLaserShape
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/sensors/RaySensor.hh:189:41: note: 'GetLaserShape' declared
      here
      public: physics::MultiRayShapePtr GetLaserShape() const
                                        ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_lidar_plugin.cpp:69:5: error: no matching function for call to
      'dynamic_pointer_cast'
    std::dynamic_pointer_cast<sensors::RaySensor>(_parent);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4927:1: note: candidate
      template ignored: could not match 'std::__1::shared_ptr' against 'boost::shared_ptr'
dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_lidar_plugin.cpp:78:56: error: no member named 'WorldName' in
      'gazebo::sensors::RaySensor'; did you mean 'GetWorldName'?
  this->world = physics::get_world(this->parentSensor->WorldName());
                                                       ^~~~~~~~~
                                                       GetWorldName
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/sensors/Sensor.hh:177:27: note: 'GetWorldName' declared here
      public: std::string GetWorldName() const;
                          ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_lidar_plugin.cpp:85:25: error: no member named 'LaserShape' in
      'gazebo::sensors::RaySensor'; did you mean 'GetLaserShape'?
    this->parentSensor->LaserShape()->ConnectNewLaserScans(
                        ^~~~~~~~~~
                        GetLaserShape
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/sensors/RaySensor.hh:189:41: note: 'GetLaserShape' declared
      here
      public: physics::MultiRayShapePtr GetLaserShape() const
                                        ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_lidar_plugin.cpp:107:48: error: no member named 'RangeMin' in
      'gazebo::sensors::RaySensor'
  lidar_message.set_min_distance(parentSensor->RangeMin());
                                 ~~~~~~~~~~~~  ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_lidar_plugin.cpp:108:48: error: no member named 'RangeMax' in
      'gazebo::sensors::RaySensor'
  lidar_message.set_max_distance(parentSensor->RangeMax());
                                 ~~~~~~~~~~~~  ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_lidar_plugin.cpp:109:52: error: no member named 'Range' in
      'gazebo::sensors::RaySensor'
  lidar_message.set_current_distance(parentSensor->Range(0));
                                     ~~~~~~~~~~~~  ^
7 errors generated.
make[7]: *** [CMakeFiles/gazebo_lidar_plugin.dir/src/gazebo_lidar_plugin.cpp.o] Error 1
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:60:5: error: no matching function for call to
      'dynamic_pointer_cast'
    std::dynamic_pointer_cast<sensors::CameraSensor>(_sensor);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4927:1: note: candidate
      template ignored: could not match 'std::__1::shared_ptr' against 'boost::shared_ptr'
dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:69:9: error: no matching function for call to
      'dynamic_pointer_cast'
    if (std::dynamic_pointer_cast<sensors::DepthCameraSensor>(_sensor))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4927:1: note: candidate
      template ignored: could not match 'std::__1::shared_ptr' against 'boost::shared_ptr'
dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:77:38: error: no member named 'Camera' in
      'gazebo::sensors::CameraSensor'
  this->camera = this->parentSensor->Camera();
                 ~~~~~~~~~~~~~~~~~~  ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:89:31: error: no member named 'ImageWidth' in
      'gazebo::rendering::Camera'; did you mean 'GetImageWidth'?
  this->width = this->camera->ImageWidth();
                              ^~~~~~~~~~
                              GetImageWidth
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/rendering/Camera.hh:245:36: note: 'GetImageWidth' declared
      here
      public: virtual unsigned int GetImageWidth() const;
                                   ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:90:32: error: no member named 'ImageHeight' in
      'gazebo::rendering::Camera'; did you mean 'GetImageHeight'?
  this->height = this->camera->ImageHeight();
                               ^~~~~~~~~~~
                               GetImageHeight
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/rendering/Camera.hh:253:36: note: 'GetImageHeight' declared
      here
      public: virtual unsigned int GetImageHeight() const;
                                   ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:91:31: error: no member named 'ImageDepth' in
      'gazebo::rendering::Camera'; did you mean 'GetImageDepth'?
  this->depth = this->camera->ImageDepth();
                              ^~~~~~~~~~
                              GetImageDepth
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/rendering/Camera.hh:257:28: note: 'GetImageDepth' declared
      here
      public: unsigned int GetImageDepth() const;
                           ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:92:32: error: no member named 'ImageFormat' in
      'gazebo::rendering::Camera'; did you mean 'GetImageFormat'?
  this->format = this->camera->ImageFormat();
                               ^~~~~~~~~~~
                               GetImageFormat
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/rendering/Camera.hh:261:27: note: 'GetImageFormat' declared
      here
      public: std::string GetImageFormat() const;
                          ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:126:26: error: no member named 'ImageData' in
      'gazebo::rendering::Camera'; did you mean 'GetImageData'?
  _image = this->camera->ImageData(0);
                         ^~~~~~~~~
                         GetImageData
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/rendering/Camera.hh:365:44: note: 'GetImageData' declared
      here
      public: virtual const unsigned char *GetImageData(unsigned int i = 0);
                                           ^
/Users/ada/UAV/src/Firmware_cmake/Tools/sitl_gazebo/src/gazebo_opticalFlow_plugin.cpp:137:31: error: no member named 'RenderRate' in
      'gazebo::rendering::Camera'; did you mean 'GetRenderRate'?
  double rate = this->camera->RenderRate();
                              ^~~~~~~~~~
                              GetRenderRate
/usr/local/Cellar/gazebo7/7.0.0-20150824-1969aea/include/gazebo-7.0/gazebo/rendering/Camera.hh:107:22: note: 'GetRenderRate' declared
      here
      public: double GetRenderRate() const;
                     ^
9 errors generated.
make[7]: *** [CMakeFiles/gazebo_opticalFlow_plugin.dir/src/gazebo_opticalFlow_plugin.cpp.o] Error 1

Looks like I'm missing something? Or have the wrong version of something..

nicolaerosia commented 8 years ago

Can you search your system for FindEigen.cmake or FindEigen3.cmake ? If you have it, then you can add that path to CMAKE_MODULE_PATH

nicolaerosia commented 8 years ago

Are you sure you have Gazebo 7? https://github.com/PX4/sitl_gazebo/blob/master/src/gazebo_lidar_plugin.cpp#L68

AndreasAntener commented 8 years ago

yes, 7.0.0-20150824-1969aea /usr/local/Cellar/eigen/3.2.8/share/cmake/Modules/FindEigen3.cmake

AndreasAntener commented 8 years ago

So Eigen will be found by adding

list(APPEND CMAKE_MODULE_PATH /usr/local/share/cmake/Modules)

which comes from $(brew --prefix)/share/cmake/Modules

Some info about this issue here: https://github.com/Homebrew/legacy-homebrew/issues/44937

LorenzMeier commented 8 years ago

Does that fix the entire compilation for you?

LorenzMeier commented 8 years ago

Fixed in 0abc792d96729544f7765e18a58a8681f0f2a96f.

AndreasAntener commented 8 years ago

@LorenzMeier no it doesn't fix the compilation issues, these are separate. I assume it works for you on Mac? Gazebo difference?

LorenzMeier commented 8 years ago

Can you install 6.5 as per our documentation and report back if that works?

AndreasAntener commented 8 years ago

Don't know anymore why I had 7 in the first place, did we work with that initially on Mac? Anyway, solved by reverting to 6.5.