RoboStack / ros-galactic

Vinca build files for ROS 2 Galactic Geochelone
https://robostack.github.io
21 stars 14 forks source link

CMake Error "Invalid character escape '\L'" on Windows #55

Closed traversaro closed 3 years ago

traversaro commented 3 years ago

I have a ros-galactic based CI at https://github.com/robotology-playground/yarp-ros2, and I noticed that the last nightly job it failed on Windows with this error:

2021-10-22T02:39:37.6739603Z CMake Error at C:/Miniconda/envs/test/Library/share/rosidl_generator_c/cmake/rosidl_generator_c-extras.cmake:7 (rosidl_generator_c_extras):
2021-10-22T02:39:37.6740954Z   Syntax error in cmake code at
2021-10-22T02:39:37.6741709Z 
2021-10-22T02:39:37.6742601Z     C:/Miniconda/envs/test/Library/share/rosidl_generator_c/cmake/rosidl_generator_c-extras.cmake:9
2021-10-22T02:39:37.6743299Z 
2021-10-22T02:39:37.6743765Z   when parsing string
2021-10-22T02:39:37.6744148Z 
2021-10-22T02:39:37.6745058Z     C:/Miniconda/envs/test\Lib\site-packages/rosidl_generator_c/__init__.py
2021-10-22T02:39:37.6745680Z 
2021-10-22T02:39:37.6746124Z   Invalid character escape '\L'.
2021-10-22T02:39:37.6746644Z Call Stack (most recent call first):
2021-10-22T02:39:37.6747773Z   C:/Miniconda/envs/test/Library/share/rosidl_generator_c/cmake/rosidl_generator_cConfig.cmake:41 (include)
2021-10-22T02:39:37.6749174Z   C:/Miniconda/envs/test/Library/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:11 (find_package)
2021-10-22T02:39:37.6750103Z -- Configuring incomplete, errors occurred!
2021-10-22T02:39:37.6751195Z See also "D:/a/yarp-ros2/yarp-ros2/build/CMakeFiles/CMakeOutput.log".
2021-10-22T02:39:37.6752287Z   C:/Miniconda/envs/test/Library/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
2021-10-22T02:39:37.6754003Z   C:/Miniconda/envs/test/Library/share/rosidl_default_runtime/cmake/rosidl_default_runtime-extras.cmake:12 (find_package)
2021-10-22T02:39:37.6755367Z   C:/Miniconda/envs/test/Library/share/rosidl_default_runtime/cmake/rosidl_default_runtimeConfig.cmake:41 (include)
2021-10-22T02:39:37.6757063Z   C:/Miniconda/envs/test/Library/share/builtin_interfaces/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
2021-10-22T02:39:37.6758669Z   C:/Miniconda/envs/test/Library/share/builtin_interfaces/cmake/builtin_interfacesConfig.cmake:41 (include)
2021-10-22T02:39:37.6760118Z   C:/Miniconda/envs/test/Library/share/rcl_interfaces/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
2021-10-22T02:39:37.6761989Z   C:/Miniconda/envs/test/Library/share/rcl_interfaces/cmake/rcl_interfacesConfig.cmake:41 (include)
2021-10-22T02:39:37.6763236Z   C:/Miniconda/envs/test/Library/share/rcl/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
2021-10-22T02:39:37.6764717Z   C:/Miniconda/envs/test/Library/share/rcl/cmake/rclConfig.cmake:41 (include)
2021-10-22T02:39:37.6766000Z   C:/Miniconda/envs/test/Library/share/libstatistics_collector/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
2021-10-22T02:39:37.6767822Z   C:/Miniconda/envs/test/Library/share/libstatistics_collector/cmake/libstatistics_collectorConfig.cmake:41 (include)
2021-10-22T02:39:37.6769291Z   C:/Miniconda/envs/test/Library/share/rclcpp/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
2021-10-22T02:39:37.6770684Z   C:/Miniconda/envs/test/Library/share/rclcpp/cmake/rclcppConfig.cmake:41 (include)
2021-10-22T02:39:37.6771610Z   CMakeLists.txt:59 (find_package)

Failed CI: https://github.com/robotology-playground/yarp-ros2/runs/3971167242 . Last successful CI: https://github.com/robotology-playground/yarp-ros2/actions/runs/1366124795 .

traversaro commented 3 years ago

The working packages was win-64/ros-galactic-rosidl-generator-c-2.2.1-py38hae75d3f_0.tar.bz2, while win-64/ros-galactic-rosidl-generator-c-2.2.1-py38hae75d3f_1.tar.bz2 is the broken one. The offending %CONDA_PREFIX%/Library/share/rosidl_generator_c/cmake/rosidl_generator_c-extras.cmake.

For the working package (build 0), is:

# generated from rosidl_generator_c/rosidl_generator_c-extras.cmake

# use the same type of library
set(rosidl_generator_c_LIBRARY_TYPE "SHARED")

include("${CMAKE_CURRENT_LIST_DIR}/register_c.cmake")
rosidl_generator_c_extras(
  "${rosidl_generator_c_DIR}/../../../lib/rosidl_generator_c/rosidl_generator_c"
  "${rosidl_generator_c_DIR}/../../../Lib/site-packages/rosidl_generator_c/__init__.py"
  "${rosidl_generator_c_DIR}/../resource"
)

while for the broken one (build 1) is (before the conda prefix substitution):

# generated from rosidl_generator_c/rosidl_generator_c-extras.cmake

# use the same type of library
set(rosidl_generator_c_LIBRARY_TYPE "SHARED")

include("${CMAKE_CURRENT_LIST_DIR}/register_c.cmake")
rosidl_generator_c_extras(
  "${rosidl_generator_c_DIR}/../../../lib/rosidl_generator_c/rosidl_generator_c"
  "C:/bld/ros-galactic-rosidl-generator-c_1634877503882/_h_env/Lib/site-packages/rosidl_generator_c/__init__.py"
  "${rosidl_generator_c_DIR}/../resource"
)
traversaro commented 3 years ago

Probably related to https://github.com/RoboStack/ros-galactic/commit/c4106e439fd455d9c06f62b0f8d6951af84788a7#diff-4ddd82d847248f72b93220196f66048d80d5879c148753937597486bc2e856ce . Note that the \L that is problematic for CMake is probably inserted by the code in conda that makes the relocation, so I wonder if the issue is elsewhere.

Tobias-Fischer commented 3 years ago

Hi Silvio, I think this issue should actually be fixed by https://github.com/RoboStack/ros-galactic/commit/c4106e439fd455d9c06f62b0f8d6951af84788a7#diff-4ddd82d847248f72b93220196f66048d80d5879c148753937597486bc2e856ce

There was a version of ros-galactic-rosidl-generator-c (which I have overridden [i.e. it is not available anymore] as it caused trouble as reported by you) that contained backslashes. The new version contains only forward slashes, and the issue should be gone.

Can you check whether the next nightly works again?

traversaro commented 3 years ago

Can you check whether the next nightly works again?

I triggered a new build in https://github.com/traversaro/yarp-ros2/actions/runs/1373905818, and indeed the problem reported in this issue is not present anymore, but the build now fails:

-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
CMake Error at C:/Miniconda/envs/test/Library/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found
  version "3.10.0")
Call Stack (most recent call first):
  C:/Miniconda/envs/test/Library/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Miniconda/envs/test/Library/share/cmake-3.21/Modules/FindPython/Support.cmake:3166 (find_package_handle_standard_args)
  C:/Miniconda/envs/test/Library/share/cmake-3.21/Modules/FindPython3.cmake:485 (include)
-- Configuring incomplete, errors occurred!
See also "D:/a/yarp-ros2/yarp-ros2/build/CMakeFiles/CMakeOutput.log".
  C:/Miniconda/envs/test/Library/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:20 (find_package)
See also "D:/a/yarp-ros2/yarp-ros2/build/CMakeFiles/CMakeError.log".
  C:/Miniconda/envs/test/Library/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
  C:/Miniconda/envs/test/Library/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
  ros2_interfaces_ws/src/map2d_nws_ros2_msgs/CMakeLists.txt:42 (rosidl_generate_interfaces)

Probably the wrong Python is found?

traversaro commented 3 years ago

Probably the wrong Python is found?

For some reason for Windows builds I was passing -DPYTHON_EXECUTABLE:PATH=%CONDA_PREFIX%\python.exe instead of -DPython3_EXECUTABLE:PATH=%CONDA_PREFIX%\python.exe, I guess it was related to https://github.com/ros2/ros2/issues/962 / https://github.com/ros2/python_cmake_module/issues/6 .

traversaro commented 3 years ago

In any case, we can close the issue as it is indeed solved, thanks!