Closed MichaelOrlov closed 1 year ago
cc: @amacneil amd @clalancette I have spent 2-3 days trying to make mcap_vendor
package to be successfully built on Windows but have no more ideas why it fails.
Unfortunately I don't have yet a local setup of Windows with installed ROS2 environment to be able to debug this issue in more details locally.
I am sorry but I am also don't have more time resources to handle this issue. At least in next 1-2 weeks.
@amacneil We also have bunch of warnings on Windows build in mcap
sources which we need to address.
Checking Build System
Building Custom Rule C:/ci/ws/src/ros-tooling/rosbag2_storage_mcap/mcap_vendor/CMakeLists.txt
main.cpp
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\internal.hpp(54,46): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(67,23): warning C4244: 'argument': conversion from 'uint64_t' to 'long', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(324,16): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(548,43): warning C4267: '=': conversion from 'size_t' to 'uint16_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(549,45): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(550,57): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(551,53): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(552,47): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(1013,40): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(1020,47): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(1034,33): warning C4244: '+=': conversion from 'uint64_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\reader.inl(1068,45): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\crc32.hpp(86,44): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(45,16): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(268,93): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(268,93): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(907,57): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(907,57): warning C4267: 'initializing': conversion from 'size_t' to 'const uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(924,81): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(924,81): warning C4267: 'initializing': conversion from 'size_t' to 'const uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(993,83): warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
C:\ci\ws\build\mcap_vendor\_deps\mcap-src\cpp\mcap\include\mcap\writer.inl(993,83): warning C4267: 'initializing': conversion from 'size_t' to 'const uint32_t', possible loss of data [C:\ci\ws\build\mcap_vendor\mcap.vcxproj]
lz4.c
lz4frame.c
lz4hc.c
xxhash.c
mcap.vcxproj -> C:\ci\ws\build\mcap_vendor\Release\mcap.dll
@MichaelOrlov I think I've run into this issue before with ros2_tracing
. It might be due to no symbols being exported on Windows. See here: https://gitlab.com/ros-tracing/ros2_tracing/-/issues/37#note_198689672. The solution would be to add visibility macros, e.g., ROSBAG2_STORAGE_..._PUBLIC
. You can probably refer to these changes: https://gitlab.com/ros-tracing/ros2_tracing/-/merge_requests/74/diffs
@christophebedard The problem is that this is a vendor package and we are not own the source code in this package to be able to add visibility macros.
@MichaelOrlov if you submit a PR to upstream mcap we can get that added.
@jhurliman I know. The problem is that to submit PR need to be assure that it will help. i.e. need to try to fix it locally with Windows build.
I'm going to attempt a windows environment setup tomorrow to try reproducing and debugging the issue. I have a machine with windows installed now, but it's not set up for ros dev yet. Wish me luck haha.
Progress update: I do have a windows environment working and am reproducing this error locally, now digging into the CMake to find out what is the cause of the error. I don't think that the issue is a lack of exported symbols (yet), because the immediate problem is a mismatch between whether the consumer expects mcap.dll
- which is created - or mcap.lib
which is not being created, and I think is supposed to just be for static libraries?
@emersonknapp It was a hypothesis that mcap.lib
not created because there are no any exported elements.
Yes, you're right, I've just confirmed that if there are no exported symbols at all, then the .lib
is not created, but as soon as any dllexport
is present then it is. I am adding visibility macros similar to the ones used in other ros2 packages, and testing to see which exports are strictly required.
Description
Latest
main
does not pass CI on WindowsExpected Behavior
Windows CI shall pass green without errors and warnings
Additional context
Build fails with error message:
From the log file It looks like
mcap.lib
hasn't been built during the build process for some unknown reasons. Also from logs it looks like it was builtmcap.dll
but notmcap.lib
.