RoboStack / ros-humble

Recipes for ROS 2 Humble Hawksbill
81 stars 32 forks source link

Windows Failure February 2024 #136

Closed traversaro closed 3 months ago

traversaro commented 3 months ago

Solution to issue cannot be found in the documentation.

Issue

.

Installed packages

.

Environment info

.
traversaro commented 3 months ago

ros-humble-hardware-interface from https://github.com/RoboStack/ros-humble/actions/runs/7822959925/job/21362114531

generic_system.obj : error LNK2019: unresolved external symbol "bool __cdecl hardware_interface::parse_bool(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse_bool@hardware_interface@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual enum rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn __cdecl mock_components::GenericSystem::on_init(struct hardware_interface::HardwareInfo const &)" (?on_init@GenericSystem@mock_components@@UEAA?AW4CallbackReturn@LifecycleNodeInterface@node_interfaces@rclcpp_lifecycle@@AEBUHardwareInfo@hardware_interface@@@Z) [%SRC_DIR%\build\fake_components.vcxproj]
%SRC_DIR%\build\Release\fake_components.dll : fatal error LNK1120: 2 unresolved externals [%SRC_DIR%\build\fake_components.vcxproj]
  Building Custom Rule C:/bld/ros-humble-hardware-interface-0_1707395987970/work/ros-humble-hardware-interface/src/work/CMakeLists.txt
  generic_system.cpp
generic_system.obj : error LNK2019: unresolved external symbol "double __cdecl hardware_interface::stod(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?stod@hardware_interface@@YANAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: void __cdecl mock_components::GenericSystem::initialize_storage_vectors(class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > > &,class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > > &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &,class std::vector<struct hardware_interface::ComponentInfo,class std::allocator<struct hardware_interface::ComponentInfo> > const &)" (?initialize_storage_vectors@GenericSystem@mock_components@@AEAAXAEAV?$vector@V?$vector@NV?$allocator@N@std@@@std@@V?$allocator@V?$vector@NV?$allocator@N@std@@@std@@@2@@std@@0AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@AEBV?$vector@UComponentInfo@hardware_interface@@V?$allocator@UComponentInfo@hardware_interface@@@std@@@4@@Z) [%SRC_DIR%\build\mock_components.vcxproj]
generic_system.obj : error LNK2019: unresolved external symbol "bool __cdecl hardware_interface::parse_bool(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse_bool@hardware_interface@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual enum rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn __cdecl mock_components::GenericSystem::on_init(struct hardware_interface::HardwareInfo const &)" (?on_init@GenericSystem@mock_components@@UEAA?AW4CallbackReturn@LifecycleNodeInterface@node_interfaces@rclcpp_lifecycle@@AEBUHardwareInfo@hardware_interface@@@Z) [%SRC_DIR%\build\mock_components.vcxproj]
%SRC_DIR%\build\Release\mock_components.dll : fatal error LNK1120: 2 unresolved externals [%SRC_DIR%\build\mock_components.vcxproj]
traversaro commented 3 months ago

ros-humble-parameter-traits:

-- Found FastRTPS: C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/include  
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE  
-- Found tcb_span: 1.0.2 (C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/share/tcb_span/cmake)
-- Found tl_expected: 1.0.2 (C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/share/tl_expected/cmake)
CMake Error at C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/share/rsl/cmake/rsl-targets.cmake:86 (message):
  The imported target "rsl::rsl" references the file

     "C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/lib/rsl.lib"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/share/rsl/cmake/rsl-targets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  C:/bld/ros-humble-parameter-traits-0_1707397532934/_h_env/Library/share/rsl/cmake/rsl-config.cmake:9 (include)
  CMakeLists.txt:8 (find_package)
traversaro commented 3 months ago

ros-humble-hardware-interface from https://github.com/RoboStack/ros-humble/actions/runs/7822959925/job/21362114531

generic_system.obj : error LNK2019: unresolved external symbol "bool __cdecl hardware_interface::parse_bool(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse_bool@hardware_interface@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual enum rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn __cdecl mock_components::GenericSystem::on_init(struct hardware_interface::HardwareInfo const &)" (?on_init@GenericSystem@mock_components@@UEAA?AW4CallbackReturn@LifecycleNodeInterface@node_interfaces@rclcpp_lifecycle@@AEBUHardwareInfo@hardware_interface@@@Z) [%SRC_DIR%\build\fake_components.vcxproj]
%SRC_DIR%\build\Release\fake_components.dll : fatal error LNK1120: 2 unresolved externals [%SRC_DIR%\build\fake_components.vcxproj]
  Building Custom Rule C:/bld/ros-humble-hardware-interface-0_1707395987970/work/ros-humble-hardware-interface/src/work/CMakeLists.txt
  generic_system.cpp
generic_system.obj : error LNK2019: unresolved external symbol "double __cdecl hardware_interface::stod(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?stod@hardware_interface@@YANAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: void __cdecl mock_components::GenericSystem::initialize_storage_vectors(class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > > &,class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > > &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &,class std::vector<struct hardware_interface::ComponentInfo,class std::allocator<struct hardware_interface::ComponentInfo> > const &)" (?initialize_storage_vectors@GenericSystem@mock_components@@AEAAXAEAV?$vector@V?$vector@NV?$allocator@N@std@@@std@@V?$allocator@V?$vector@NV?$allocator@N@std@@@std@@@2@@std@@0AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@AEBV?$vector@UComponentInfo@hardware_interface@@V?$allocator@UComponentInfo@hardware_interface@@@std@@@4@@Z) [%SRC_DIR%\build\mock_components.vcxproj]
generic_system.obj : error LNK2019: unresolved external symbol "bool __cdecl hardware_interface::parse_bool(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse_bool@hardware_interface@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual enum rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn __cdecl mock_components::GenericSystem::on_init(struct hardware_interface::HardwareInfo const &)" (?on_init@GenericSystem@mock_components@@UEAA?AW4CallbackReturn@LifecycleNodeInterface@node_interfaces@rclcpp_lifecycle@@AEBUHardwareInfo@hardware_interface@@@Z) [%SRC_DIR%\build\mock_components.vcxproj]
%SRC_DIR%\build\Release\mock_components.dll : fatal error LNK1120: 2 unresolved externals [%SRC_DIR%\build\mock_components.vcxproj]

This issue is more subtle, I need more time to work on this.

traversaro commented 3 months ago

ros-humble-hardware-interface from https://github.com/RoboStack/ros-humble/actions/runs/7822959925/job/21362114531

generic_system.obj : error LNK2019: unresolved external symbol "bool __cdecl hardware_interface::parse_bool(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse_bool@hardware_interface@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual enum rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn __cdecl mock_components::GenericSystem::on_init(struct hardware_interface::HardwareInfo const &)" (?on_init@GenericSystem@mock_components@@UEAA?AW4CallbackReturn@LifecycleNodeInterface@node_interfaces@rclcpp_lifecycle@@AEBUHardwareInfo@hardware_interface@@@Z) [%SRC_DIR%\build\fake_components.vcxproj]
%SRC_DIR%\build\Release\fake_components.dll : fatal error LNK1120: 2 unresolved externals [%SRC_DIR%\build\fake_components.vcxproj]
  Building Custom Rule C:/bld/ros-humble-hardware-interface-0_1707395987970/work/ros-humble-hardware-interface/src/work/CMakeLists.txt
  generic_system.cpp
generic_system.obj : error LNK2019: unresolved external symbol "double __cdecl hardware_interface::stod(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?stod@hardware_interface@@YANAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: void __cdecl mock_components::GenericSystem::initialize_storage_vectors(class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > > &,class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > > &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &,class std::vector<struct hardware_interface::ComponentInfo,class std::allocator<struct hardware_interface::ComponentInfo> > const &)" (?initialize_storage_vectors@GenericSystem@mock_components@@AEAAXAEAV?$vector@V?$vector@NV?$allocator@N@std@@@std@@V?$allocator@V?$vector@NV?$allocator@N@std@@@std@@@2@@std@@0AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@AEBV?$vector@UComponentInfo@hardware_interface@@V?$allocator@UComponentInfo@hardware_interface@@@std@@@4@@Z) [%SRC_DIR%\build\mock_components.vcxproj]
generic_system.obj : error LNK2019: unresolved external symbol "bool __cdecl hardware_interface::parse_bool(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse_bool@hardware_interface@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual enum rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn __cdecl mock_components::GenericSystem::on_init(struct hardware_interface::HardwareInfo const &)" (?on_init@GenericSystem@mock_components@@UEAA?AW4CallbackReturn@LifecycleNodeInterface@node_interfaces@rclcpp_lifecycle@@AEBUHardwareInfo@hardware_interface@@@Z) [%SRC_DIR%\build\mock_components.vcxproj]
%SRC_DIR%\build\Release\mock_components.dll : fatal error LNK1120: 2 unresolved externals [%SRC_DIR%\build\mock_components.vcxproj]

This issue is more subtle, I need more time to work on this.

For sure https://github.com/ros-controls/ros2_control/pull/1382 should help, but I still have local failures that not appear in CI.

traversaro commented 3 months ago

New error:

2024-02-09T12:37:26.0605099Z   1>Checking Build System
2024-02-09T12:37:26.0605949Z   Building Custom Rule C:/Users/runneradmin/micromamba/envs/testpr_env/conda-bld/ros-0_1707480098180/work/ros-humble-rosbag2-storage/src/work/CMakeLists.txt
2024-02-09T12:37:26.0606749Z   metadata_io.cpp
2024-02-09T12:37:26.0606981Z   Defining YAML_CPP_API for DLL import
2024-02-09T12:37:26.0607280Z   ros_helper.cpp
2024-02-09T12:37:26.0607495Z   storage_factory.cpp
2024-02-09T12:37:26.0607742Z   Defining YAML_CPP_API for DLL import
2024-02-09T12:37:26.0608035Z   storage_options.cpp
2024-02-09T12:37:26.0608279Z   Defining YAML_CPP_API for DLL import
2024-02-09T12:37:26.0608570Z   base_io_interface.cpp
2024-02-09T12:37:26.0608824Z   Defining YAML_CPP_API for DLL import
2024-02-09T12:37:26.0609109Z   Generating Code...
2024-02-09T12:37:26.0609633Z LINK : fatal error LNK1181: cannot open input file 'yaml-cpp.lib' [%SRC_DIR%\build\rosbag2_storage.vcxproj]
2024-02-09T12:37:26.0610128Z 
2024-02-09T12:37:26.0610132Z 
2024-02-09T12:37:26.0610221Z Work directory: 
2024-02-09T12:37:26.0610628Z C:\Users\runneradmin\micromamba\envs\testpr_env\conda-bld\ros-0_1707480098180\w
2024-02-09T12:37:26.0611083Z ork
Tobias-Fischer commented 3 months ago

Have attempted to fix by using yaml-cpp directly instead of the vendored version.

traversaro commented 3 months ago

Have attempted to fix by using yaml-cpp directly instead of the vendored version.

That worked, we have no a similar failure on a related package:

2024-02-10T12:10:12.3963108Z   1>Checking Build System
2024-02-10T12:10:12.3964700Z   Building Custom Rule C:/Users/runneradmin/micromamba/envs/testpr_env/conda-bld/ros-0_1707563690380/work/ros-humble-rosbag2-storage-default-plugins/src/work/CMakeLists.txt
2024-02-10T12:10:12.3966339Z   sqlite_wrapper.cpp
2024-02-10T12:10:12.3966770Z   Defining YAML_CPP_API for DLL import
2024-02-10T12:10:12.3967385Z   sqlite_storage.cpp
2024-02-10T12:10:12.3967802Z   Defining YAML_CPP_API for DLL import
2024-02-10T12:10:12.3968324Z   sqlite_statement_wrapper.cpp
2024-02-10T12:10:12.3968796Z   Generating Code...
2024-02-10T12:10:12.3969881Z LINK : fatal error LNK1181: cannot open input file 'yaml-cpp.lib' [%SRC_DIR%\build\rosbag2_storage_default_plugins.vcxproj]
traversaro commented 3 months ago

Ok, I investigated more the issue. The core problem is that yaml-cpp <= 0.7.0 uses the yaml-cpp as exported target, while yaml-cpp >= 0.8.0 uses yaml-cpp::yaml-cpp (see https://github.com/jbeder/yaml-cpp/blob/yaml-cpp-0.7.0/CMakeLists.txt#L150 vs https://github.com/jbeder/yaml-cpp/blob/0.8.0/CMakeLists.txt#L171). yaml_cpp_vendor is not aware of this, so it always set the yaml_cpp_vendor_TARGETS variable as yaml-cpp (see https://github.com/ros2/yaml_cpp_vendor/blob/4f17f410b1251b24142b3d1af809e6a65a33168d/yaml_cpp_vendor-extras.cmake.in#L14). The error probably goes unnoticed on Linux as it the yaml-cpp target does not exists, it is interpreted when passed to target_link_libraries in https://github.com/ament/ament_cmake/blob/6b310f5e3078fe4473904bac8415aa3622f8868a/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake#L152 as simple library, and the linker automatically finds the libyaml-cpp.so library or similar, but this is not happening on Windows for some reason.

Interestingly, everything would work fine with master yaml-cpp, as that provides both yaml-cpp::yaml-cpp and yaml-cpp targets (see https://github.com/jbeder/yaml-cpp/commit/c26e047223248dfa1d4bafe228437bc1397751a6#diff-d2d2bab1fd2c176e4a5f1d4b5ad2ed98ae2407df5b11906bed3d5e7ba206fc2dR22-R28), even if the yaml-cpp target will be removed in yaml-cpp 0.10.0 .

traversaro commented 3 months ago

Ok, I investigated more the issue. The core problem is that yaml-cpp <= 0.7.0 uses the yaml-cpp as exported target, while yaml-cpp >= 0.8.0 uses yaml-cpp::yaml-cpp (see https://github.com/jbeder/yaml-cpp/blob/yaml-cpp-0.7.0/CMakeLists.txt#L150 vs https://github.com/jbeder/yaml-cpp/blob/0.8.0/CMakeLists.txt#L171). yaml_cpp_vendor is not aware of this, so it always set the yaml_cpp_vendor_TARGETS variable as yaml-cpp (see https://github.com/ros2/yaml_cpp_vendor/blob/4f17f410b1251b24142b3d1af809e6a65a33168d/yaml_cpp_vendor-extras.cmake.in#L14). The error probably goes unnoticed on Linux as it the yaml-cpp target does not exists, it is interpreted when passed to target_link_libraries in https://github.com/ament/ament_cmake/blob/6b310f5e3078fe4473904bac8415aa3622f8868a/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake#L152 as simple library, and the linker automatically finds the libyaml-cpp.so library or similar, but this is not happening on Windows for some reason.

Interestingly, everything would work fine with master yaml-cpp, as that provides both yaml-cpp::yaml-cpp and yaml-cpp targets (see jbeder/yaml-cpp@c26e047#diff-d2d2bab1fd2c176e4a5f1d4b5ad2ed98ae2407df5b11906bed3d5e7ba206fc2dR22-R28), even if the yaml-cpp target will be removed in yaml-cpp 0.10.0 .

I proposed an upstream fix for this in https://github.com/ros2/yaml_cpp_vendor/pull/46 .

traversaro commented 3 months ago

I proposed an upstream fix for this in ros2/yaml_cpp_vendor#46 .

I backported this in the PR in https://github.com/RoboStack/ros-humble/pull/137/commits/ac9b73e2660d836a05a1f5bfc4ad81d0d0dba759 . @Tobias-Fischer any idea on how to force the rebuild of the ros-humble-yaml-cpp-vendor package? Thanks!

Tobias-Fischer commented 3 months ago

All fixed - thanks @traversaro