geometry2 icon indicating copy to clipboard operation
geometry2 copied to clipboard

tf2_py build failure with catkin symlink install

Open dgoel opened this issue 5 years ago • 1 comments

tf2_py project errors out when building with symlink install option for catkin with catkin-tools (or colcon). This does not happen if symlink option is not enabled.

The main cause is that catkin does not handle cmake generator expression in the install functions for cmake. Nevertheless, proposing a fix here.

Version(s) affected

I have only tested with melodic-devel but this should also affect noetic-devel.

How to reproduce

With ros melodic distro:

# clone
$ mkdir -p ros_ws/src
$ cd ros_ws
$ git clone https://github.com/ros/geometry2 src

# build
$ catkin init
$ catkin config --install --cmake-args -DCATKIN_SYMLINK_INSTALL:BOOL=ON
$ catkin build

Build error:

CMake Error at catkin_symlink_install/catkin_symlink_install.cmake:157 (message):
  catkin_symlink_install_files() can't find
  '/home/user/ros_ws/src/tf2_py/$<TARGET_FILE:tf2_py>'
Call Stack (most recent call first):
  catkin_symlink_install/catkin_symlink_install.cmake:343 (catkin_symlink_install_files)
  cmake_install.cmake:41 (include)


make: *** [install] Error 1

Proposed fix

This can be fixed by not using cmake generator expression in the install as follows:

$ git diff
diff --git a/tf2_py/CMakeLists.txt b/tf2_py/CMakeLists.txt

-install(FILES $<TARGET_FILE:tf2_py>
+install(TARGETS tf2_py
     DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
 )

I am happy to open a PR if this is acceptable.

dgoel avatar Nov 25 '20 22:11 dgoel

+1

mqcmd196 avatar Feb 25 '24 04:02 mqcmd196