1

Rosanswers logo

I am having difficultly understanding the difference between a normal colcon build and colcon build --symlink-install.


Originally posted by Shiva_uchiha on ROS Answers with karma: 117 on 2021-02-15

Post score: 9


Original comments

Comment by ThomasL624 on 2022-10-20:
Hi base on this question, I would like to ask could I remove the src log build directories after colcon build --symlink-install?

The reason for doing that is I want to mount a volume (which is the ROS2 workspace) from Host into a docker container.

So, I have to:

  1. COPY the workspace (include packages), WORKDIR to that path in Dockerfile and mkdir src
  2. Run rosdep update && rosdep install --from-paths . --ignore-src --rosdistro $ROS_DISTRO
  3. Run RUN source /opt/ros/"$ROS_DISTRO"/setup.bash && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

This will generate the install build log src directories inside the container, which will not be used, as the host volume will mount and replace it.

Should I delete it? or will it breaks the packages? If so, what is the best approach to mount a workspace from Host which already built in Dockerfile?

2 Answers2

0

Rosanswers logo

with symlink-install if you change code in your source code, it will take effect, you don't have to compile it again (ony with python, not c++)


Originally posted by drtritm with karma: 187 on 2021-02-19

This answer was NOT ACCEPTED on the original site

Post score: 14


Original comments

Comment by sansevieria22 on 2021-06-07:
very nice! Thank you very much!

Comment by Joe28965 on 2021-06-11:
also for urdf I believe. PS @sansevieria22 please accept the answer as the correct answer, to remove it from the 'unanswered' list.

Comment by Andromeda on 2021-07-15:
but do you need to use . install/setup.bash anyway?

Comment by Mahmoud Kamel on 2021-07-27:
Yes, You still need to source setup.bash so that the packages / nodes in this local workspace would be available to use. You can add it to your .bashrc file: source ~/PATH_TO_WS/install/setup.bash

0

Rosanswers logo

with symlink-install if you change code in your source code, it will take effect, you don't have to compile it again (ony with python, not c++)

There is also an additional very good advantage for c++. When you use IDE such as VScode the navigation funcionality works better. For example, if you navigate from the integrated terminal to some error in a header file, it brings you to the source code file (instead of the install folder file)


Originally posted by Pablo Iñigo Blasco with karma: 2982 on 2021-08-12

This answer was NOT ACCEPTED on the original site

Post score: 4