question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using install with catkin build results in devel/setup.bash disabling finding packages in the workspace

See original GitHub issue

System Info

  • Operating System: Linux 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Python Version: Python 2.7.15+
  • Version of catkin_tools: catkin_tools 0.4.5 © 2014-2019 Open Source Robotics Foundation
  • ROS Distro: melodic

Build / Run Issue

If one configures their workspace for installation then sources devel/setup.bash, common rosbash commands no longer work as desired because these commands find packages in the install space before the workspace. This causes a lot of headaches when developing in workspaces that are configured for installation.

Expected Behavior

For example, after running source devel/setup.bash, a command like rosed my-pkg my-launch-file should edit my-launch-file in my-pkg in the workspace (if in fact my-pkg is a package in the workspace).

Actual Behavior

Staying with the above example, what will happen is rosed my-pkg my-launch-file will edit my-launch-file in the install space instead of the workspace.

Steps to Reproduce the Issue

If one configures any workspace for installation and builds i.e.

catkin config --install
catkin clean -b
catkin build

and the workspace has a pkg X, then do the following:

source devel/setup.bash
roscd X

This will change your directory to the X package in the install space, and not the workspace like it should.

Hint

Going a little deeper: when the problem occurs, you’ll see that ROS_PACKAGE_PATH lists the install space before the workspace packages. I see that ROS_PACKAGE_PATH is generated from the CMAKE_PREFIX_PATH in devel/_setup_util.py, and that in the __main__ function of _setup_util.py, there is line of the form

CMAKE_PREFIX_PATH= '/path/to/install-space;/opt/ros/melodic;/path/to/devel-space'.split(';')

I think that the install-space path should come last in the line above.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
nsteelecommented, Oct 28, 2019

I was seeing slightly different behavior than @nalt when I tried this in an existing ws of mine, but I can reproduce @nalt 's result when I start with a new ws. Here’s how:

mkdir -p test/src
cd test
source /opt/ros/melodic/setup.bash
catkin init
catkin create pkg -p src mypkg
catkin build
source devel/setup.bash
echo $ROS_PACKAGE_PATH # result: /path/to/mypkg:/opt/ros/melodic/share GOOD!
catkin config --install
catkin clean -b # remove only the build space
catkin build
source devel/setup.bash
echo $ROS_PACKAGE_PATH # result: /path/to/mypkg:/opt/ros/melodic/share GOOD!
catkin clean # remove build, devel, and install spaces
catkin build
source devel/setup.bash
echo $ROS_PACKAGE_PATH #result: /opt/ros/melodic/share BAD!

So I can now describe the problem a little more precisely: when the workspace is configured for install, and the devel space is rebuilt, then source devel/setup.bash gives an incorrect $ROS_PACKAGE_PATH. If the workspace is configured for install after the devel space is already built, then source devel/setup.bash will give the correct $ROS_PACKAGE_PATH until the devel space is rebuilt.

2reactions
naltcommented, Oct 28, 2019

For me, it does not even add the install space:

$ . devel/setup.bash 
$ echo $ROS_PACKAGE_PATH 
/opt/ros/melodic/share

While in the install space:

$ . install/setup.bash 
$ echo $ROS_PACKAGE_PATH 
.../workspace/install/share:/opt/ros/melodic/share
Read more comments on GitHub >

github_iconTop Results From Across the Web

catkin config – Configure a Workspace
--no-install Disables installing each package into the install space. --isolate-install Install each catkin package into a separate install space. --merge- ...
Read more >
Error with catkin build with ds4_driver - ROS Answers
After disabling the install space, cleaning and rebuilding the workspace, things started working again, even after source devel/setup.bash .
Read more >
catkin_tools command man page - ManKier
You can install the catkin_tools package as a binary through a package manager ... all packages in the workspace source /tmp/quickstart_ws/devel/setup.bash ...
Read more >
Development Environment - Personal Robotics Lab
Build it using catkin build my_package; Verify that the build succeeded; Source setup.bash again. When removing a package from a workspace: Clean the...
Read more >
Create a catkin workspace and a ROS package
(Optional) add ROS setup.bash to the .bashrc. Make the catkin_ws directory. Use catkin_make to initialise. Source the setup.bash of the catkin workspace.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found