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

CATKIN_SETUP_DIR breaks chaining/switching workspaces #505

Closed
meyerj opened this issue Sep 6, 2013 · 6 comments
Closed

CATKIN_SETUP_DIR breaks chaining/switching workspaces #505

meyerj opened this issue Sep 6, 2013 · 6 comments
Assignees
Labels

Comments

@meyerj
Copy link
Contributor

meyerj commented Sep 6, 2013

I experienced the following problem that causes weird errors when chaining workspaces using rosws or switching between catkin workspaces without properly resetting the environment before.

The setup.sh files generated by catkin since 0.5.72 use the CATKIN_SETUP_DIR variable to find out to which workspace they belong and only use the absolute path as a default value. This variable influences the CMAKE_PREFIX_PATH set and which _setup_util.py will be executed.

If I use setup.bash, the CATKIN_SETUP_DIR will be overridden on each invocation and everything is fine. But if I source setup.sh directly and there is already a CATKIN_SETUP_DIR in the environment, the CMAKE_PREFIX_PATH and other variables will not be set correctly, but always use the workspace where CATKIN_SETUP_DIR points to. This is what tools like rosws do all the time as they read the .rosinstall file generated by catkin.

A simple solution would probably be to unset CATKIN_SETUP_DIR at the end of setup.sh. At least catkin behaves as before 0.5.72 if I add this line to all setup.sh files manually. Not sure if CATKIN_SETUP_DIR is used elsewhere?

@wjwwood
Copy link
Member

wjwwood commented Sep 6, 2013

@dirk-thomas will probably respond on this.

@dirk-thomas
Copy link
Member

Can you please post a command sequence which can be executed to reproduce your scenario?

@meyerj
Copy link
Contributor Author

meyerj commented Sep 13, 2013

Here is an example scenario with a rosbuild workspace overlaying a catkin workspace overlaying /opt/ros/hydro:

# First create a catkin workspace overlaying /opt/ros/hydro
source /opt/ros/hydro/setup.bash       # This one will set CATKIN_SETUP_DIR !
mkdir /tmp/catkin_ws
cd /tmp/catkin_ws
mkdir src
catkin_make

# Then create a rosbuild workspace overlaying /tmp/catkin_ws/devel
mkdir /tmp/rosbuild_ws
cd /tmp/rosbuild_ws
rosws init . /tmp/catkin_ws/devel

# Now source /tmp/rosbuild_ws/setup.bash
source /tmp/rosbuild_ws/setup.bash

# /tmp/catkin_ws/devel is not in the CMAKE_PREFIX_PATH now:
$ echo $CMAKE_PREFIX_PATH
/opt/ros/hydro

The problem is not related to rosbuild/rosws only. The thing is that the first line sets the CATKIN_SETUP_DIR environment variable, which IMHO should be an internal variable and unset at the end of each setup.sh file. All future invocations of setup.sh seem to be no-ops then, as CATKIN_SETUP_DIR is already set. setup.bash and friends work as they reset CATKIN_SETUP_DIR, but rosws only sources the setup.sh file and sets CATKIN_SHELL itself.

If you start with a clean environment, the CMAKE_PREFIX_PATH will be set correctly. However, switching to another workspace using setup.sh is not possbile as long as CATKIN_SETUP_DIR is still set.

@dirk-thomas
Copy link
Member

Thanks for the detailed report.

I was able to unset CATKIN_SETUP_DIR (now with a prefix for indicating that it is meant to be private). That also applied to other variable but they were cleanly overwritten every time - not like CATKIN_SETUP_DIR which was not set if already existing.

@meyerj
Copy link
Contributor Author

meyerj commented Sep 17, 2013

Related question on ROS answers: http://answers.ros.org/question/80231/cannot-build-rosbuild-workspace-on-top-of-catkin-workspace-in-hydro/

@dirk-thomas Can you give an estimate when this fix will be released in groovy/hydro?
Will existing setup files be overwritten on each cmake run?

@dirk-thomas
Copy link
Member

I just released catkin 0.5.74. The rebuild of all packages on the farm + syncing to the repos will take a while...

Yes, catkin will regenerate existing setup files when being invoked the next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants