catkin / catkin_tools

Command line tools for working with catkin
Apache License 2.0
163 stars 146 forks source link

catkin build --no-deps <package> fails if `catkin` package is present in workspace #737

Closed rhaschke closed 1 year ago

rhaschke commented 1 year ago

When running catkin build --no-deps <package> in a workspace including the catkin package, catkin tools will build this catkin package instead of catkin_tools_prebuild!? Additionally, build order is not respected, as additional packages are built in parallel to catkin. This can cause additional issues down the road.

catkin clr; catkin build --no-deps tf2_msgs
==> Expanding alias 'clr' from 'catkin clr' to 'catkin clean --yes --build --devel --logs'
[clean] Removing Build Space: /homes/rhaschke/src/ros/build
[clean] Removing Devel Space: /homes/rhaschke/src/ros/devel
[clean] Removing Log Space: /homes/rhaschke/src/ros/logs
--------------------------------------------------------------
Profile:                     foo
Extending:        [explicit] /opt/ros/noetic
Workspace:                   /homes/rhaschke/src/ros
--------------------------------------------------------------
Build Space:        [exists] /homes/rhaschke/src/ros/build
Devel Space:        [exists] /homes/rhaschke/src/ros/devel
Install Space:      [unused] /homes/rhaschke/src/ros/install
Log Space:         [missing] /homes/rhaschke/src/ros/logs
Source Space:       [exists] /homes/rhaschke/src/ros/src
DESTDIR:            [unused] None
--------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
--------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
--------------------------------------------------------------
Buildlisted Packages:        tactile_msgs agni_serial_protocol
Skiplisted Packages:         None
--------------------------------------------------------------
Workspace configuration appears valid.

NOTE: Forcing CMake to run for each package.
--------------------------------------------------------------
[build] Found 421 packages in 0.0 seconds.                                                                                                                          
[build] Updating package table.                                                                                                                                     
Starting  >>> catkin                                                                                                                                                
Starting  >>> tf2_msgs                                                                                                                                              
Finished  <<< catkin                  [ 2.3 seconds ]                                                                                                               
Finished  <<< tf2_msgs                [ 2.8 seconds ]                                                                                                               
[build] Summary: All 2 packages succeeded!                                                                                                                          
[build]   Ignored:   419 packages were skipped or are skiplisted.                                                                                                   
[build]   Warnings:  None.                                                                                                                                          
[build]   Abandoned: None.                                                                                                                                          
[build]   Failed:    None.                                                                                                                                          
[build] Runtime: 3.3 seconds total.                                                                                                                                 
[build] Note: Workspace packages have changed, please re-source setup files to use them.

vs.

catkin clr; catkin config --buildlist tf2_msgs; catkin build
 ==> Expanding alias 'clr' from 'catkin clr' to 'catkin clean --yes --build --devel --logs'
[clean] Removing Build Space: /homes/rhaschke/src/ros/build
[clean] Removing Devel Space: /homes/rhaschke/src/ros/devel
[clean] Removing Log Space: /homes/rhaschke/src/ros/logs
------------------------------------------------------------
Profile:                     foo
Extending:        [explicit] /opt/ros/noetic
Workspace:                   /homes/rhaschke/src/ros
------------------------------------------------------------
Build Space:       [missing] /homes/rhaschke/src/ros/build
Devel Space:       [missing] /homes/rhaschke/src/ros/devel
Install Space:      [unused] /homes/rhaschke/src/ros/install
Log Space:         [missing] /homes/rhaschke/src/ros/logs
Source Space:       [exists] /homes/rhaschke/src/ros/src
DESTDIR:            [unused] None
------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
------------------------------------------------------------
Buildlisted Packages:        tf2_msgs
Skiplisted Packages:         None
------------------------------------------------------------
Workspace configuration appears valid.
------------------------------------------------------------
------------------------------------------------------------
Profile:                     foo
Extending:        [explicit] /opt/ros/noetic
Workspace:                   /homes/rhaschke/src/ros
------------------------------------------------------------
Build Space:        [exists] /homes/rhaschke/src/ros/build
Devel Space:        [exists] /homes/rhaschke/src/ros/devel
Install Space:      [unused] /homes/rhaschke/src/ros/install
Log Space:         [missing] /homes/rhaschke/src/ros/logs
Source Space:       [exists] /homes/rhaschke/src/ros/src
DESTDIR:            [unused] None
------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
------------------------------------------------------------
Buildlisted Packages:        tf2_msgs
Skiplisted Packages:         None
------------------------------------------------------------
Workspace configuration appears valid.

NOTE: Forcing CMake to run for each package.
------------------------------------------------------------
[build] Found 421 packages in 0.0 seconds.                                                                                                                          
[build] Updating package table.                                                                                                                                     
Starting  >>> catkin_tools_prebuild                                                                                                                                 
Finished  <<< catkin_tools_prebuild                [ 1.1 seconds ]                                                                                                  
Starting  >>> tf2_msgs                                                                                                                                              
Finished  <<< tf2_msgs                             [ 2.8 seconds ]                                                                                                  
[build] Summary: All 2 packages succeeded!                                                                                                                          
[build]   Ignored:   420 packages were skipped or are skiplisted.                                                                                                   
[build]   Warnings:  None.                                                                                                                                          
[build]   Abandoned: None.                                                                                                                                          
[build]   Failed:    None.                                                                                                                                          
[build] Runtime: 4.3 seconds total.                                                                                                                                 
[build] Note: Workspace packages have changed, please re-source setup files to use them.

I would expect that both cases behave exactly the same, i.e. building catkin_tools_prebuild first and then continuing with all other packages. Removing the catkin package from the workspace yields the expected behavior again.

timonegk commented 1 year ago

Hi, sorry it took so long, but I finally came around to put some work into catkin_tools again. I believe that this issue and #736 have the same cause. When --no-deps is specified, prebuild packages are just added to the build list and not added as dependencies of the other packages. Thanks a lot for raising the issue, I believe that it has existed since at least 2016.

rhaschke commented 1 year ago

Thanks a lot!