ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
9

what is the use of --symlink-install in ROS2 colcon build?

asked 2021-02-15 01:10:06 -0600

Shiva_uchiha gravatar image

updated 2021-02-15 02:31:57 -0600

gvdhoorn gravatar image

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

edit retag flag offensive close merge delete

Comments

Hi base on this question, I would like to ask could I remove the srclogbuild 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 installbuildlogsrc 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?

ThomasL624 gravatar image ThomasL624  ( 2022-10-20 01:25:24 -0600 )edit

2 Answers

Sort by » oldest newest most voted
14

answered 2021-02-19 00:54:29 -0600

drtritm gravatar image

updated 2021-02-19 00:56:40 -0600

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++)

edit flag offensive delete link more

Comments

very nice! Thank you very much!

sansevieria22 gravatar image sansevieria22  ( 2021-06-07 04:19:40 -0600 )edit

also for urdf I believe. PS @sansevieria22 please accept the answer as the correct answer, to remove it from the 'unanswered' list.

Joe28965 gravatar image Joe28965  ( 2021-06-11 03:28:32 -0600 )edit

but do you need to use . install/setup.bash anyway?

Andromeda gravatar image Andromeda  ( 2021-07-15 12:46:36 -0600 )edit

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

Mahmoud Kamel gravatar image Mahmoud Kamel  ( 2021-07-27 03:09:06 -0600 )edit
4

answered 2021-08-12 12:35:16 -0600

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)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-02-15 01:10:06 -0600

Seen: 12,223 times

Last updated: Oct 20 '22