Linking failure during build of `gazebo_ros` package on Windows - Unresolved external symbol in `protobuf`
Opened this issue · 0 comments
Hello ROS Developers,
I encountered a linking error while building the gazebo_ros
package on Windows. The build process fails with an unresolved external symbol related to Google's protobuf
library. Below are the relevant details from the build log:
gazebo_ros_node.vcxproj -> C:\Users\...\build\gazebo_ros\Release\gazebo_ros_node.dll
gazebo_ros_utils.vcxproj -> C:\Users\...\build\gazebo_ros\Release\gazebo_ros_utils.dll
gazebo_ros_factory.vcxproj -> C:\Users\...\build\gazebo_ros\Release\gazebo_ros_factory.dll
gazebo_ros_force_system.vcxproj -> C:\Users\...\build\gazebo_ros\Release\gazebo_ros_force_system.dll
gazebo_ros_init.cpp
Creating library C:/Users/.../build/gazebo_ros/Release/gazebo_ros_init.lib and object C:/Users/.../build/gazebo_ros/Release/gazebo_ros_init.exp
gazebo_ros_init.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl google::protobuf::MessageLite::ParseFromString(class std::basic_string_view<char,struct std::char_traits<char> >)"
(__imp_?ParseFromString@MessageLite@protobuf@google@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z), referenced in function "public: virtual bool __cdecl gazebo::transport::CallbackHelperT<class gazebo::msgs::PerformanceMetrics>::HandleData(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::function<void __cdecl(unsigned int)>,unsigned int)"
(?HandleData@?$CallbackHelperT@VPerformanceMetrics@msgs@gazebo@@@transport@gazebo@@UEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$function@$$A6AXI@Z@boost@@I@Z)
[C:\Users\...\build\gazebo_ros\gazebo_ros_init.vcxproj]
C:\Users\...\build\gazebo_ros\Release\gazebo_ros_init.dll : fatal error LNK1120: 1 unresolved externals [C:\Users\...\build\gazebo_ros\gazebo_ros_init.vcxproj]
The error occurs with gazebo_ros_init (gazebo_ros) and gazebo_ros_ray_sensor (gazebo_plugins).
System Information:
- OS: Windows 11 Pro
- ROS 2 Distro: Humble
- Compiler: MSVC (Visual Studio 2019)
- Build Tool: CMake
- Gazebo version: 11.14.0
vcpkg: ignition-msgs5:x64-windows (Version 5.3.0#7) and protobuf:x64-windows (4.25.1#1 )
Steps to Reproduce:
- Clone the
gazebo_ros_pkgs
repository. - Attempt to build the package using
colcon
orCMake
. - Observe the linker error during the build.
Additional Information:
I have installed protobuf
using vcpkg
and confirmed that the required libraries are available in my system. However, the linker still fails to resolve the MessageLite::ParseFromString
symbol.
Any assistance or guidance to resolve this issue would be greatly appreciated.