abb_robot_driver: Windows build failing

Hi, When I try to build the package on Windows using catkin_make_isolated (because catkin build isn’t supported on Windows) this is my CMakeError log:

Click to expand
Determining if the include file pthread.h exists failed with the following output:
Change Dir: C:/Users/Dyuman/catkin_ws/build_isolated/abb_rapid_msgs/CMakeFiles/CMakeTmp

Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_d3d33 && [1/2] Building C object CMakeFiles\cmTC_d3d33.dir\CheckIncludeFile.c.obj

FAILED: CMakeFiles/cmTC_d3d33.dir/CheckIncludeFile.c.obj 

C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe  /nologo   /DWIN32 /D_WINDOWS /W3  /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_d3d33.dir\CheckIncludeFile.c.obj /FdCMakeFiles\cmTC_d3d33.dir\ /FS -c CheckIncludeFile.c

CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
ninja: build stopped: subcommand failed.

And this is my CMakeOutput log:

Click to expand
The system is: Windows - 10.0.19042 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCCompilerId.exe 
CMakeCCompilerId.obj 


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.exe"

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj"

The C compiler identification is MSVC, found in "C:/Users/Dyuman/catkin_ws/build_isolated/abb_rapid_msgs/CMakeFiles/3.18.2/CompilerIdC/CMakeCCompilerId.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/Dyuman/catkin_ws/build_isolated/abb_rapid_msgs/CMakeFiles/3.18.2/CompilerIdCXX/CMakeCXXCompilerId.exe"

Detecting C compiler ABI info compiled with the following output:
Change Dir: C:/Users/Dyuman/catkin_ws/build_isolated/abb_rapid_msgs/CMakeFiles/CMakeTmp

Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_c4114 && [1/2] Building C object CMakeFiles\cmTC_c4114.dir\CMakeCCompilerABI.c.obj

[2/2] Linking C executable cmTC_c4114.exe




Detecting CXX compiler ABI info compiled with the following output:
Change Dir: C:/Users/Dyuman/catkin_ws/build_isolated/abb_rapid_msgs/CMakeFiles/CMakeTmp

Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_92086 && [1/2] Building CXX object CMakeFiles\cmTC_92086.dir\CMakeCXXCompilerABI.cpp.obj

[2/2] Linking CXX executable cmTC_92086.exe

Can this package be build on Windows? If not, what is the best way to use this package on Ubuntu and run RobotStudio on Windows?

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 51 (21 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for that. The fix in https://github.com/ros-simulation/gazebo_ros_pkgs/pull/1023 seems like something which we could use here.

It isn’t a hack, clearly visible in the build script and there’s precedence for it in a package which sees a lot of usage.

A hold over from early DOS, ERROR, OK and several other common words were #defined. For source compatibility, these were brought into headers brought into windows.h. #define is not namespaced, so any user downstream will have these overwritten - and ultimately have a duplicate define or build break.

For most of ROS, we were able to resolve this, as ROS headers do include windows,h, but have an #undef ERROR to work around the ROS versions of ERROR, including those in msg files.

Internally to boost, the headers will include windows,h, which will redefine ERROR. In order to not pollute the code with Windows specific things, we typically reorder headers if that resolves the build break, otherwise add an additional #undef ERROR after boost headers.

I hope that helps explaining the root cause.

Sorry for the previous post, for a moment I misunderstood and thought it is to build some windows stuff for the driver to work on Linux

I’d still throw in the idea of trying to avoid the offending header completely.

On Thu, 11 Mar 2021, 20:47 G.A. vd. Hoorn, @.***> wrote:

Could you clarify what you mean by that @bmagyar https://github.com/bmagyar ?

Are you saying we should prevent people from trying to build this on Windows?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ros-industrial/abb_robot_driver/issues/17#issuecomment-797038435, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA24PYMYIG2G7F7DEOW7PXTTDET75ANCNFSM4YS7D4WA .

@bmagyar Keeping it building is quite easy - github actions can be added to build on Linux and Windows during CI. Check out https://aka.ms/ros for the docs.

@traversaro wrote:

In my experience Protobuf headers may include Windows.h, so a first test that it may be worth is to do is move the #include <google/protobuf/text_format.h> from https://github.com/ros-industrial/abb_robot_driver/blob/master/abb_egm_hardware_interface/src/egm_hardware_interface.cpp#L40 to be included after #include “abb_egm_hardware_interface/egm_hardware_interface.h” .

I tried this, and get essentially the same errors, although it looks slightly different towards the end:

Apparently something else brings in protobuf headers. Then the only alternative is to either generate the full header include tree to understand who is including it (by adding /showIncludes to CMAKE_CXX_FLAGS, not sure how you do that via catkin), or just add a:

#pragma push_macro("ERROR")
#undef ERROR

before the problematic ros_control include, and:

#pragma pop_macro("ERROR")

after. However, this is not a great solution if some other part of the code use the ERROR as defined by ros_control.

@traversaro wrote:

I never used ros_control on Windows.

ms-iot/ROSOnWindows#294 (comment), hmm? 😃

Quoting for the issue:

because we needed a non-ROS package to consume it as a dependency, so even if the fix was upstreamed we could not use it.

Our local modification transformed the RSI driver in a standalone library and switched to use cartesian interface instead of the joint one, so the first thing done was to remove any ros_control dependency.

@DyumanAditya: could you check whether https://github.com/ros-industrial/abb_robot_driver_interfaces/pull/9 solves your build issues?

Or at least this build issue?

Ok.

So first: I don’t think what you find in CMakeError.log is related.

I believe there is a problem with some of the characters in some of the .msg files in abb_rapid_msgs. Linux and OSX are fine with this, but Windows is a bit stricter with the codepages and can’t decode the bytes to proper characters.

These two .msgs are suspicious:

the links point to the specific lines which I believe contain the potentially “offending” characters.

Could you try to remove the ° from RobTarget.msg first and see whether things build then.

If they don’t, remove the “ from ExtJoint.msg and try again.