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

Fix ign server -s on Windows (take two) #52

Merged
merged 14 commits into from
Oct 20, 2022

Conversation

traversaro
Copy link
Contributor

@traversaro traversaro commented Oct 19, 2022

Re-do of #49 after cherry-picking gazebosim/gz-sim#1574 on the 6.12.0 release (branch for reference: https://github.com/traversaro/ign-gazebo/tree/backportwindowsfixgz6120).

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

@traversaro
Copy link
Contributor Author

@conda-forge-admin, please rerender

@github-actions
Copy link
Contributor

Hi! This is the friendly automated conda-forge-webservice.

I tried to rerender for you, but it looks like there was nothing to do.

This message was generated by GitHub actions workflow run https://github.com/conda-forge/libignition-gazebo-feedstock/actions/runs/3284461027.

@traversaro
Copy link
Contributor Author

@conda-forge-admin, please rerender

@traversaro
Copy link
Contributor Author

In 7d53cfd I enabled the upload of artifacts by the CI jobs, so that I can test locally if ign gazebo -s is working fine after this changes.

@traversaro
Copy link
Contributor Author

As there are a few doubts in gazebosim/gz-sim#1764 (comment) about some stranges CI failures on Ubuntu, let's apply the patch just on Windows.

@traversaro
Copy link
Contributor Author

I tried this locally, but for some reason it is failing with:

(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>ign gazebo -s .\shapes.sdf
Library error: C:/Users/STraversaro/AppData/Local/mambaforge/envs/libignition-gazebo6/Library/lib/ignition-tools-backward.dll not found. Improved backtrace generation will be disabled
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-physics-system] : couldn't find shared library.
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-user-commands-system] : couldn't find shared library.
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-scene-broadcaster-system] : couldn't find shared library.

For some reason, the files installed by the https://github.com/gazebosim/gz-sim/blob/ign-gazebo6/src/systems/CMakeLists.txt#L85 are not copied correctly in the conda packaage.

@traversaro
Copy link
Contributor Author

I tried this locally, but for some reason it is failing with:

(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>ign gazebo -s .\shapes.sdf
Library error: C:/Users/STraversaro/AppData/Local/mambaforge/envs/libignition-gazebo6/Library/lib/ignition-tools-backward.dll not found. Improved backtrace generation will be disabled
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-physics-system] : couldn't find shared library.
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-user-commands-system] : couldn't find shared library.
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-scene-broadcaster-system] : couldn't find shared library.

For some reason, the files installed by the https://github.com/gazebosim/gz-sim/blob/ign-gazebo6/src/systems/CMakeLists.txt#L85 are not copied correctly in the conda packaage.

Actually, this is not the problem. The problem is probably related to the fact that binary relocation does not work correctly on Windows. Anyhow, setting the path to find plugins manually, i.e.:

(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>set IGN_GAZEBO_PHYSICS_ENGINE_PATH=C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\lib\ign-physics-5\engine-plugins
(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>set IGN_GAZEBO_PHYSICS_ENGINE_PATH=C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\lib\ign-physics-5\engine-plugins

The test described in gazebosim/gz-sim#1574 is working fine.

@traversaro
Copy link
Contributor Author

traversaro commented Oct 20, 2022

I tried this locally, but for some reason it is failing with:

(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>ign gazebo -s .\shapes.sdf
Library error: C:/Users/STraversaro/AppData/Local/mambaforge/envs/libignition-gazebo6/Library/lib/ignition-tools-backward.dll not found. Improved backtrace generation will be disabled
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-physics-system] : couldn't find shared library.
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-user-commands-system] : couldn't find shared library.
[Err] [D:\bld\libignition-gazebo6_1666215155937\work\src\SystemLoader.cc:64] Failed to load system plugin [ignition-gazebo-scene-broadcaster-system] : couldn't find shared library.

For some reason, the files installed by the https://github.com/gazebosim/gz-sim/blob/ign-gazebo6/src/systems/CMakeLists.txt#L85 are not copied correctly in the conda packaage.

Actually, this is not the problem. The problem is probably related to the fact that binary relocation does not work correctly on Windows. Anyhow, setting the path to find plugins manually, i.e.:

(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>set IGN_GAZEBO_PHYSICS_ENGINE_PATH=C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\lib\ign-physics-5\engine-plugins
(libignition-gazebo6) C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\share\ignition\ignition-gazebo6\worlds>set IGN_GAZEBO_SYSTEM_PLUGIN_PATH=C:\Users\STraversaro\AppData\Local\mambaforge\envs\libignition-gazebo6\Library\lib\ign-gazebo-6\plugins

The test described in gazebosim/gz-sim#1574 is working fine.

Probably the variables that we need to make sure to override with env variables are all the one contained in ignition\gazebo\config.hh, i.e. :

#define IGNITION_GAZEBO_GUI_CONFIG_PATH "D:/bld/libignition-gazebo6_1666215155937/_h_env/Library/share/ignition/ignition-gazebo6/gui"
#define IGNITION_GAZEBO_SYSTEM_CONFIG_PATH "D:/bld/libignition-gazebo6_1666215155937/_h_env/Library/share/ignition/ignition-gazebo6/systems"
#define IGNITION_GAZEBO_SERVER_CONFIG_PATH "D:/bld/libignition-gazebo6_1666215155937/_h_env/Library/share/ignition/ignition-gazebo6"
#define IGN_GAZEBO_PLUGIN_INSTALL_DIR "D:/bld/libignition-gazebo6_1666215155937/_h_env/Library/lib/ign-gazebo-6/plugins"
#define IGN_GAZEBO_GUI_PLUGIN_INSTALL_DIR "D:/bld/libignition-gazebo6_1666215155937/_h_env/Library/lib/ign-gazebo-6/plugins/gui"
#define IGN_GAZEBO_WORLD_INSTALL_DIR "D:/bld/libignition-gazebo6_1666215155937/_h_env/Library/share/ignition/ignition-gazebo6/worlds"

In this table I try to map each C preprocssor macro with the corresponding env variable:

Macro Env Variable Related Code
IGNITION_GAZEBO_GUI_CONFIG_PATH Apparently, it does not exists. https://github.com/gazebosim/gz-sim/blob/4e10c35624b554eb9bd4cfaabea5dd4e2dd0f0ab/src/gui/Gui.cc#L93
IGNITION_GAZEBO_SYSTEM_CONFIG_PATH Apparently, it is not used. https://github.com/gazebosim/gz-sim/search?q=GZ_SIM_SYSTEM_CONFIG_PATH
IGNITION_GAZEBO_SERVER_CONFIG_PATH Apparently, it does not exists. A IGN_GAZEBO_SERVER_CONFIG_PATH variable exists, but it has a different meaning. https://github.com/gazebosim/gz-sim/blob/1258c5286012419fc34ac06dfcbb2b2dbf12533d/src/ServerConfig.cc#L927
IGN_GAZEBO_PLUGIN_INSTALL_DIR IGN_GAZEBO_SYSTEM_PLUGIN_PATH
IGN_GAZEBO_GUI_PLUGIN_INSTALL_DIR IGN_GUI_PLUGIN_PATH
IGN_GAZEBO_WORLD_INSTALL_DIR IGN_GAZEBO_RESOURCE_PATH https://github.com/gazebosim/gz-sim/blob/4e10c35624b554eb9bd4cfaabea5dd4e2dd0f0ab/src/Util.cc#L732, https://github.com/gazebosim/gz-sim/blob/4e10c35624b554eb9bd4cfaabea5dd4e2dd0f0ab/include/ignition/gazebo/Util.hh#L291
IGNITION_PHYSICS_ENGINE_INSTALL_DIR Note: this is actually defined in ign-physics, while the corresponding env variable is defined and read by ign-gazebo IGN_GAZEBO_PHYSICS_ENGINE_PATH

See gazebosim/gz-sim#626 for a related issue.

@traversaro
Copy link
Contributor Author

Investigating Gazebo Sim docs I found two more env variables, i.e. IGN_GAZEBO_RENDER_ENGINE_PATH (related issue: gazebosim/gz-sim#1765) and IGN_GAZEBO_PHYSICS_ENGINE_PATH, but there is no need to set them as ignition gazebo does not install any rendering or physics engine beside the one already installed by ign-physics and ign-rendering. Anyhow, we need to make sure that the env variable used by those libraries are properly set.

@traversaro
Copy link
Contributor Author

Investigating Gazebo Sim docs I found two more env variables, i.e. IGN_GAZEBO_RENDER_ENGINE_PATH (related issue: gazebosim/gz-sim#1765) and IGN_GAZEBO_PHYSICS_ENGINE_PATH, but there is no need to set them as ignition gazebo does not install any rendering or physics engine beside the one already installed by ign-physics and ign-rendering. Anyhow, we need to make sure that the env variable used by those libraries are properly set.

Actually it turns out that the rendering and physics library on their own do not provide any mechanism to override the default directory specified by the code, so we need to set this variables here, as the variables are consumed just by ign-gazebo.

@traversaro
Copy link
Contributor Author

Investigating Gazebo Sim docs I found two more env variables, i.e. IGN_GAZEBO_RENDER_ENGINE_PATH (related issue: gazebosim/gz-sim#1765) and IGN_GAZEBO_PHYSICS_ENGINE_PATH, but there is no need to set them as ignition gazebo does not install any rendering or physics engine beside the one already installed by ign-physics and ign-rendering. Anyhow, we need to make sure that the env variable used by those libraries are properly set.

Actually it turns out that the rendering and physics library on their own do not provide any mechanism to override the default directory specified by the code, so we need to set this variables here, as the variables are consumed just by ign-gazebo.

Actually, this is not completly true: for gz-rendering, there is the GZ_RENDERING_PLUGIN_PATH env variable, see https://github.com/gazebosim/gz-rendering/blob/90a13e0b295766bb3a3a33ef3da195d2fc52521b/src/RenderEngineManager.cc#L103 . Instead for gz-physics there is no env variable, and the directory used to search for physics engines are just manager by Ignition Gazebo/gz-sim .

@traversaro
Copy link
Contributor Author

traversaro commented Oct 20, 2022

In bafc5db and 3647c71 I added all the env variables I was able to add to solve the problem that is caused by ign-gazebo not being relocatable (gazebosim/gz-sim#626) and of the binary relocation not properly working on Windows.

@traversaro
Copy link
Contributor Author

traversaro commented Oct 20, 2022

In bafc5db and 3647c71 I added all the env variables I was able to add to solve the problem that is caused by ign-gazebo not being relocatable and of the binary relocation not properly working on Windows.

That was almost correct. The only wrong one was the IGNITION_GAZEBO_SERVER_CONFIG_PATH, that even if it has the same name of the preprocessor macro, it has a different meaning, so you can't just override it. So, for the time being we can't do anything, let's avoid to set it. However, I am not really sure that the simulation is actually correctly running if the default server.config file was not copied and used.

@traversaro traversaro added the automerge Merge the PR when CI passes label Oct 20, 2022
@github-actions github-actions bot merged commit a7d8966 into conda-forge:main Oct 20, 2022
@github-actions
Copy link
Contributor

Hi! This is the friendly conda-forge automerge bot!

I considered the following status checks when analyzing this PR:

  • linter: passed
  • azure: passed

Thus the PR was passing and merged! Have a great day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge the PR when CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants