rosconsole icon indicating copy to clipboard operation
rosconsole copied to clipboard

Fails to build on Windows: missing header?

Open gonzalocasas opened this issue 3 years ago • 0 comments

I'm reporting this here as a follow up of https://github.com/RoboStack/ros-noetic/issues/88. I was testing ros-noetic on Windows 10 using the conda packages provided by RoboStack. Everything worked out just fine with the base installs. Afterwards, I tried to create a catkin ws and build it, but I got an error that apparently is rooted in a missing header in https://github.com/ros/rosconsole/blob/noetic-devel/include/ros/console.h

The package I tried to build on my catkin workspace is https://github.com/gramaziokohler/ros_file_server. It's really minimal and it is the only one in my catkin workspace. The error I get when I run catkin_make is:

[ 90%] Building CXX object ros_file_server/CMakeFiles/file_server.dir/src/file_server.cpp.obj
file_server.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xlocale(319): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(126): error C2039: 'shared_ptr': is not a member of 'boost'
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(71): note: see declaration of 'boost'
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(126): error C2143: syntax error: missing ';' before '<'
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(126): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(127): error C2065: 'TokenPtr': undeclared identifier
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(127): error C2923: 'std::vector': 'TokenPtr' is not a valid template type argument for parameter '_Ty'
C:\Users\gcasas\anaconda3\envs\ros\Library\include\ros/console.h(127): error C3203: 'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type
C:\Users\gcasas\anaconda3\envs\ros\Library\include\boost/bind.hpp(41): note: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.
NMAKE : fatal error U1077: 'C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
Invoking "nmake" failed

I was able to workaround the problem adding boost's headers as recommended on the original thread https://github.com/RoboStack/ros-noetic/issues/88#issuecomment-805453758 but I guess that's not a proper fix because the same package builds without issues on Linux:

#include <boost/shared_ptr.hpp>

namespace boost {
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ) { throw 11; };
#endif
}

gonzalocasas avatar Apr 06 '21 08:04 gonzalocasas