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 build with linked develspace and install: true causes source devel/setup.bash to not work #674

Closed
2 of 4 tasks
shuhaowu opened this issue Apr 10, 2021 · 7 comments · Fixed by #725
Closed
2 of 4 tasks

Comments

@shuhaowu
Copy link

System Info

  • Operating System: Linux starfruit 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux (actually running inside a customized osrf/ros:noetic-desktop-full-focal docker container)
  • Python Version: Python 3.8.2
  • Version of catkin_tools: 0.5.0
  • ROS Distro: noetic

Build / Run Issue

  • Works with catkin_make
  • Works with catkin_make_isolated --merge
  • Works with catkin build
  • Works with catkin build -p1

So I have seen #376 and I have a very similar issue still, with a slightly different config. It's entirely possible that I'm using develspace and installspace incorrectly. I actually forked the example repo from that issue here: https://github.com/shuhaowu/catkin_tools_test_ws

The difference is that the default profile has install: true, which in my understanding would generate an installspace that I can then tarball around. My understanding is that this config would also generate a develspace, and if I source devel/setup.bash, then I be able to run the packages I'm building locally.

Except, this is not happening:

catkin build --profile default
. devel/setup.sh
rosrun py_dummy_pkg dummy.py

This gives: [rospack] Error: package 'py_dummy_pkg' not found, like the original author.

If we set install: false, then the package can be found and used.

Expected Behavior

I expect that source devel/setup.bash would setup the packages for development, despite install: true. Is this the wrong expectation?

Workaround

Create a second profile that does install: true, separate from the default profile with install = false. I also put all the spaces into a subfolder so things don't collide:

build_space: install/build
devel_space: install/devel
install_space: install/install
@timonegk
Copy link
Member

I cannot reproduce your problem. Could you run echo $ROS_PACKAGE_PATH before and after the . devel/setup.sh line and print your results?
Also, the solution to #376 was to source setup.bash instead of setup.sh. Could you try that (assuming your shell is bash)?

@enricovillagrossi
Copy link

Currently I'm facing the same problem, is there any official fix?
It doesn't work if I source setup.bash file.

@timonegk
Copy link
Member

timonegk commented Jul 5, 2021

Could you give me the output of echo $ROS_PACKAGE_PATH before and after you source the setup file?

@enricovillagrossi
Copy link

The result was always /opt/ros/noetic/share before and after sourcing the setup file. In my case, the problem disappeared when I reinstalled ROS (not trying to fix this problem but for other reasons).

@timonegk
Copy link
Member

Okay, I can now reproduce the problem, there previously was a problem on my side. The issue indeed seems to be that a linked devel space cannot be sourced when an install space is present. So the “official fix” would be to source the install space instead. For the isolated devel space, there is an error message when sourcing the devel space:

Error: This workspace was built with the '--install' option.
       You should source the setup files in the install space instead.
       Your environment has not been changed.

For the merged devel space, sourcing the devel space works even when an install space is present. I am not entirely sure why the behavior differs for the different devel space layouts and what the behavior for the linked devel space should be, but I will look into it.

@TheDelus
Copy link

TheDelus commented Mar 29, 2022

For the merged devel space, sourcing the devel space works even when an install space is present. I am not entirely sure why the behavior differs for the different devel space layouts and what the behavior for the linked devel space should be, but I will look into it.

@timonegk did you had the chance to look into it? It´s quite anoying that one can not build with linked devel space AND install the package

@timonegk
Copy link
Member

Sorry it took so long. I added a patch in #725. The issue was that there is a .catkin file in the devel folder that is used to generate ROS_PACKAGE_PATH and it was only generated when not installing. Could you test the patch and look if it resolves the problem for you as well? You can install it directly with pip via pip install git+https://github.com/catkin/catkin_tools@fix_devel_install

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 a pull request may close this issue.

4 participants