ros2 / tinyxml_vendor

Vendor package for providing tinyxml within a cmake package
Apache License 2.0
2 stars 14 forks source link

[Windows] Honor CMAKE_BUILD_TYPE from the current CMakeLists.txt to build tinyxml #13

Closed seanyen closed 5 years ago

seanyen commented 5 years ago

This problem manifests when I do a ROS2 Windows build by colcon build --merge-install --event-handlers console_cohesion+ --install-base "C:\opt\ros\crystal\x64" --cmake-args -DCMAKE_BUILD_TYPE=Release.

This is the error when linking urdfdom_world.dll:

CMakeFiles/urdfdom_world.dir/src/pose.cpp.obj CMakeFiles/urdfdom_world.dir/src/model.cpp.obj CMakeFiles/urdfdom_world.dir/src/link.cpp.obj CMakeFiles/urdfdom_world.dir/src/joint.cpp.obj CMakeFiles/urdfdom_world.dir/src/world.cpp.obj 
tinyxml.lib(tinyxml.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in pose.cpp.obj
tinyxml.lib(tinyxml.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in pose.cpp.obj
tinyxml.lib(tinyxmlparser.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in pose.cpp.obj
tinyxml.lib(tinyxmlparser.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in pose.cpp.obj
tinyxml.lib(tinyxmlerror.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in pose.cpp.obj
tinyxml.lib(tinyxmlerror.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in pose.cpp.obj
   Creating library ..\lib\urdfdom_world.lib and object ..\lib\urdfdom_world.exp
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
tinyxml.lib(tinyxml.obj) : error LNK2019: unresolved external symbol __imp__invalid_parameter referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)
tinyxml.lib(tinyxmlparser.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter
tinyxml.lib(tinyxml.obj) : error LNK2019: unresolved external symbol __imp__CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)
tinyxml.lib(tinyxmlparser.obj) : error LNK2001: unresolved external symbol __imp__CrtDbgReport
..\bin\urdfdom_world.dll : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\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\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
--- stderr: urdfdom

And trace back I found CMAKE uses "Debug" configuration to build tinyxml and it doesn't match the option -DCMAKE_BUILD_TYPE=Release passed from COLCON.

nuclearsandwich commented 5 years ago

I was briefly puzzled by the fact that this doesn't show up in our nightly windows debug job but that's likely because all our build machines use our custom tinyxml-usestl package and thus don't need to build tinyxml from source.

This and #12 both touch the same code so there may be conflicts but as far as I have looked they're compatible changes.

nuclearsandwich commented 5 years ago

CI won't actually test the change works as intended, just that it doesn't break the existing builds.