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

symlink-install only creates symlinks in the build folder NOT the install folder, why? #482

Closed
TheConstructAi opened this issue Feb 10, 2022 · 6 comments · Fixed by #592
Closed

Comments

@TheConstructAi
Copy link

Hi to reproduce this issue:

mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://bitbucket.org/theconstructcore/ros2_build_tests.git
cd ~/ros2_ws
source /opt/ros/galactic/setup.bash
colcon build --symlink-install
source install/setup.bash
ros2 run build_test_pkg script1_exe

Expected behavior

I would expect that the symlinks are inside the install folder which is the one form where we use the files

Actual behavior

It's sourcing the build folder, which I don't understand its use then

this example uses a yaml file from the install path, and no matter what you do, you need to compile to update those changes, because the file used is the one in the install folder.

Is this intended to work like this? what is the advantage then of using symlink apart from the fact of not having to compile when we only change python scripts?

And even this it's not clear how this is accomplished, where are the symlinks in the install folder to be able to use the source version of the python scripts without compiling again?

I think this is a recurring question and it's really confusing for users.

@cottsay
Copy link
Member

cottsay commented May 5, 2022

This behavior is supported by the underlying build system and isn't implemented by colcon directly.

For example, here is where colcon tells ament_cmake packages to symlink install: https://github.com/colcon/colcon-ros/blob/d7a66047e5aac95ee31eee2ef837f76919e2be9e/colcon_ros/task/ament_cmake/build.py#L50-L53

The symlink installation for Python packages is more complex and relies on the develop verb. In truth, the source code for your example build_test_pkg package uses an "egg-link" file to the package subdirectory in build, so changing the sources will affect the installed environment as you desire. Unfortunately, the data_files specified in your setup.py don't get symlinked by Python. The fact that they're using a non-symlink-based system (egg-link) to take care of linking the Python code makes me wonder if the lack of cross-platform symlink support is one reason that it isn't done for data_files.

@Usimian
Copy link

Usimian commented Sep 2, 2022

Thanks for the explanation.
Is there a fix?

@vanem
Copy link

vanem commented Mar 15, 2023

This is confusing and inconsistent: the launch files declared with CMakeLists.txt install directives ARE symlinked in the install share folder!

@HomeworldL
Copy link

I've encountered this problem as well. I need to use colcon build to recompile to update my changes (like .launch files). All the links are in the build folder. An inelegant way is to manually copy the links in the build to the install, but that is somewhat bothersome. Is there a better solution now?

@RodBelaFarin
Copy link

Any news on this? It is still not working as expected.

@cottsay
Copy link
Member

cottsay commented Nov 24, 2023

I think this issue is mostly a duplicate of #169. There is discussion there of a possible solution. If you'd like to see that solution merged, please test it and provide feedback.

@cottsay cottsay linked a pull request Feb 6, 2024 that will close this issue
@cottsay cottsay closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

6 participants