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

Support paths from macros extended to support binary relocation #36

Merged
merged 6 commits into from
Jul 7, 2021

Conversation

diegoferigo
Copy link
Contributor

@diegoferigo diegoferigo commented Jul 6, 2021

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.

This PR should fix conda-forge/libignition-gazebo-feedstock#4 by applying the patch proposed in conda-forge/libignition-gazebo-feedstock#4 (comment). I only tested this patch in Ubuntu 20.04, therefore for the moment I restricted the application to this OS. In any case, other OSs are disabled in the gazebo recipe (conda-forge/libignition-gazebo-feedstock#2).

This is my first attempt to packaging in conda, please let me know if anything is missing.

@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.

@diegoferigo
Copy link
Contributor Author

@conda-forge-admin, please rerender

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2021

Hi! This is the friendly automated conda-forge-webservice.
I tried to rerender for you, but it looks like there was nothing to do.

recipe/meta.yaml Outdated
Comment on lines 27 to 28
- git
- patch
Copy link
Contributor Author

@diegoferigo diegoferigo Jul 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I had to add these two build dependencies otherwise building the package locally in my setup (without using docker) was failing, even though the active conda environment had it (I suspect the process runs isolated in a new env). To be precise, my setup is already in a docker container, and running the docker script would require me to setup DIND.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, but please remove them. The recipe should only contain the dependency required to build the recipe on the conda-forge CI, anything else is quite difficult to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@diegoferigo
Copy link
Contributor Author

diegoferigo commented Jul 6, 2021

Also, locally I had to rebuild the ignition gazebo recipe in order to fix conda-forge/libignition-gazebo-feedstock#4, I'm not sure if bumping the build number is enough to trigger a rebuild.

@traversaro
Copy link
Contributor

Also, locally I had to rebuild the ignition gazebo recipe in order to fix conda-forge/libignition-gazebo-feedstock#4, I'm not sure if bumping the build number is enough to trigger a rebuild.

Strange, in theory it should be sufficient to just install the new version of ignition-commons, as this modification is part of the compiler library, it should not be necessary to re-build ignition-gazebo.

@diegoferigo
Copy link
Contributor Author

diegoferigo commented Jul 6, 2021

Also, locally I had to rebuild the ignition gazebo recipe in order to fix conda-forge/libignition-gazebo-feedstock#4, I'm not sure if bumping the build number is enough to trigger a rebuild.

Strange, in theory it should be sufficient to just install the new version of ignition-commons, as this modification is part of the compiler library, it should not be necessary to re-build ignition-gazebo.

I was expecting the same, but without rebuilding also gazebo, either using the ign gazebo command line or running the simulator from Python (using scenario) was segfaulting. I don't exclude there's something odd in my system, I'm not yet familiar with the process.

@traversaro
Copy link
Contributor

traversaro commented Jul 6, 2021

I only tested this patch in Ubuntu 20.04, therefore for the moment I restricted the application to this OS. In any case, other OSs are disabled in the gazebo recipe (conda-forge/libignition-gazebo-feedstock#2).

Thanks for handling this! I suggest to apply the same patch also on Windows and macOS. On a well-formed string that has \0 only as last character, that line is not doing anything. While ignition-gazebo is just building on Linux for now, I think it is just safer to have the patch in place in ignition-common for whenever macOS/Windows support is added in ignition-gazebo, without the need to actually remember to manually enable the patch on Windows/macOS whenever ign-gazebo gets macOS/Windows support.

Furthermore, this library can be already used as it is on Windows and macOS, so I think it is worth to just apply the patch everywhere.

@diegoferigo
Copy link
Contributor Author

Thanks @traversaro! I've just addressed your suggestions.

@Tobias-Fischer
Copy link
Contributor

Is it worth opening a PR upstream with this patch, or is it really only conda specific?

@diegoferigo
Copy link
Contributor Author

If our understanding of the problem is correct (conda-forge/libignition-gazebo-feedstock#4 (comment)), this is very specific to how conda pads the IGN_GAZEBO_PLUGIN_INSTALL_DIR definition in order to make the package relocatable. This problem would not likely occur in any other system.

@traversaro
Copy link
Contributor

If our understanding of the problem is correct (conda-forge/libignition-gazebo-feedstock#4 (comment)), this is very specific to how conda pads the IGN_GAZEBO_PLUGIN_INSTALL_DIR definition in order to make the package relocatable. This problem would not likely occur in any other system.

Exactly. The proper solution would be indeed to fix how conda handles the IGN_GAZEBO_PLUGIN_INSTALL_DIR definition, or understand how the padded literal is converted to a std::string to fix that at this level.

@traversaro traversaro merged commit f8241ca into conda-forge:master Jul 7, 2021
@diegoferigo diegoferigo deleted the fix/macro_path branch July 7, 2021 13:10
@wolfv
Copy link
Member

wolfv commented Jul 7, 2021

Hey, sorry for chiming in so late. There is an issue with binary relocation + std::string because most std::string implementations do "small buffer optimization" and there are certain expectations by the C++ compiler for the string to keep it's size.
Not sure if that's the issue here? We had to do something similar in RViz.

conda/conda-build#1674

@traversaro
Copy link
Contributor

Hey, sorry for chiming in so late. There is an issue with binary relocation + std::string because most std::string implementations do "small buffer optimization" and there are certain expectations by the C++ compiler for the string to keep it's size.
Not sure if that's the issue here? We had to do something similar in RViz.

conda/conda-build#1674

Yes, that's it, even in this case this happens because there is a systemPaths.AddPluginPaths(IGN_GAZEBO_PLUGIN_INSTALL_DIR); call and systemPaths.AddPluginPaths takes in input a std::string .

@traversaro
Copy link
Contributor

traversaro commented Jul 7, 2021

This is also related to conda/conda-build#2524 . In general, the best upstream solution would be to ensure that the package is actually properly relocatable, without relying on conda tricks for this.

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

Successfully merging this pull request may close these issues.

Running ign gazebo fails on Linux
5 participants