gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
669 stars 262 forks source link

Apple support for ign command line tool #25

Closed osrf-migration closed 3 years ago

osrf-migration commented 5 years ago

Original report (archived issue) by Nate Koenig (Bitbucket: Nathan Koenig).


Prerequisites

Description

The UNIT_ign_TEST fails on Apple, through homebrew, when using the ign gazebo command line tool. In general, the ign gazebo command line tool fails to load the libignition-gazebo2-ign.dylib. Other packages, such as ign-transport and ign-msgs work fine. There might be a problem associated with loading a component library.

Steps to Reproduce

  1. Change the src/ign_TEST.cc to use ign gazebo instead of ign-gazebo.
  2. Install gazebo on homebrew
  3. Run the /bin/UNIT_ign_TEST test.

Expected behavior:

The test should pass.

Actual behavior:

The test fails

Reproduces how often:

All the time.

Versions

Gazebo 2+

Additional Information

osrf-migration commented 4 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Pull request #431 removes gflags completely from ign-gazebo3, which means OSX would be left without an alternative until this is solved.

osrf-migration commented 4 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


This bug is kinda odd because other ign commands like ign transport and ign msg work just fine on macOS. One difference is that the implementation of ign gazebo functionality is in the ign-gazebo2-ign component library that must be dynamically linked to the main library. The ign log command is similar in that it uses a component library that is linked to the main library. I tested ign log record on high sierra and mojave, and it works on high sierra but fails on mojave as follows:

$ ign log record
Library error: [/usr/local/Cellar/ignition-transport7/7.1.0_1/lib/libignition-transport7-log.7.1.0.dylib] not found.

It's hard to find documentation about the changes in SIP from 10.13 to 10.14, but I believe that starting in 10.14 any binaries in /usr/bin will ignore the DYLD_LIBRARY_PATH. This is relevant because ign uses /usr/bin/ruby, and I believe it explains why it can't load the component libraries.

As a test, I installed another ruby implementation with brew install ruby and modified the shebang line of /usr/local/bin/ign to point to that other ruby in /usr/local, and it was successful!

So I think this is a clear diagnosis of the problem, though I don't have a suggested solution at this point.

osrf-migration commented 4 years ago

Original comment by Silvio Traversaro (Bitbucket: traversaro).


I may be a bit OT, but as far as I understand, the same problem will apply to Windows as well. Even if now ignition-gazebo is not supported/tested on Windows, I assume that there is interest in supporting Windows in the future.
Unfortunately, the Ruby situation in Windows is even worse. The default binaries available from https://rubyinstaller.org/ are compiled with a MinGW-w64-based toolchain, so they cannot load libraries compiled with Visual Studio, such as the Ignition Math bindings. As far as I understand in theory it is possible to compile Ruby with Visual Studio (see https://github.com/ruby/ruby/blob/master/win32/README.win32), but then it will be necessary to ship a custom Ruby interpreter just to use ignition-gazebo, and this distribution will not be compatible with most gems from RubyGems, that instead assume the MinGW-w64-based DevKit.
Related comment: https://github.com/conda-forge/ruby-feedstock/pull/30#issuecomment-532058635 .

cc Sean Yen (seanyen-msft)

osrf-migration commented 4 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


@IeiuniumLux the assimp error is different. it means that bottles are out of sync with each other. try brew outdated to see if any bottles (like dartsim@6.10.0) are old. I rebuilt some recently

osrf-migration commented 4 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


brew outdated is just a debugging step. try brew upgrade ignition-physics, which should upgrade several dependencies as well

osrf-migration commented 4 years ago

Original comment by Alfredo Bencomo (Bitbucket: bencomo, GitHub: IeiuniumLux).


Thanks @scpeters . This is not a priority for me right now so I’ll try it again when Citadel is released.

osrf-migration commented 4 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Relevant issue on ign-tools: https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-tools/issues/7/consider-binaries-to-implement-the (ignitionrobotics/ign-tools#7)

scpeters commented 3 years ago

I have been successful with ign gazebo -s when invoked with the homebrew version of ruby and have added this as a test command to the ignition-gazebo* formulae in https://github.com/osrf/homebrew-simulation/pull/1221

scpeters commented 3 years ago

I am debugging the UNIT_ign_TEST on macOS to see if we can enable at least part of it

scpeters commented 3 years ago

I've enabled UNIT_ign_TEST on macOS in https://github.com/ignitionrobotics/ign-gazebo/pull/477 by making use of the homebrew ruby formula. It also should provide more helpful error messages if a library fails to load

chapulina commented 3 years ago

Closed by #477