Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

setup.sh script is not relocatable #3056

Closed
scpeters opened this issue Aug 6, 2021 · 3 comments · Fixed by #3061
Closed

setup.sh script is not relocatable #3056

scpeters opened this issue Aug 6, 2021 · 3 comments · Fixed by #3061

Comments

@scpeters
Copy link
Member

scpeters commented Aug 6, 2021

As noted in #2782 (comment) and #2782 (comment), the setup.sh script installed with gazebo is not relocatable, as it contains install paths hard-coded at configure time. It looks like @traversaro has already done the hard work of making setup.sh relocatable in https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/blob/master/scripts/setup-gazebo.sh

So we could resolve this ticket by porting that script to this repository.

@scpeters
Copy link
Member Author

scpeters commented Aug 9, 2021

I have tried adapting @traversaro's patch in scpeters@6ba45ba and will submit a pull request after some testing

@scpeters
Copy link
Member Author

scpeters commented Aug 9, 2021

I have tried adapting @traversaro's patch in scpeters@6ba45ba and will submit a pull request after some testing

from a slack conversation: it looks like using "${BASH_SOURCE[0]}" isn't proper for a .sh script. We could tell the setup.sh script to look for a GAZEBO_INSTALL_PREFIX variable, and default to the configure-time install prefix if the variable is unset. Then we can create a relocatable bash script that detects its current location and sets GAZEBO_INSTALL_PREFIX before calling the setup.sh script. I think this is what colcon does.

also, we could try to check for errors by checking if $GAZEBO_INSTALL_PREFIX/share/setup.sh exists

@scpeters
Copy link
Member Author

I've proposed adding a relocatable setup.bash script in #3061

scpeters added a commit that referenced this issue Aug 12, 2021
Refactor setup.sh to set the `GAZEBO_*_PATH` environment
variables relative to a path specified in `GAZEBO_INSTALL_PREFIX`
environment variable (defaulting to the current behavior of setting
path variables relative to the configure-time install prefix if
`GAZEBO_INSTALL_PREFIX` is empty or unset).

Add a relocatable setup.bash script that uses bash-specific syntax
to detect the folder containing the `setup.*sh` scripts,
sets `GAZEBO_INSTALL_PREFIX` relative to that folder,
and then sources setup.sh.

Reference setup.bash in console messages and test script instead
of setup.sh.

Fixes #3056.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant