EIPScanner
EIPScanner copied to clipboard
Build Failure on UCRT64 Flavor of MSYS2
Describe the bug EIPScanner fails to build on the UCRT64 flavor of MSYS2
To Reproduce open UCRT64 terminal from MSYS2 git clone EIPScanner cd EIPScanner mkdir build cd build cmake .. ninja
Expected behavior EIPScanner should build
Screenshots
$ ninja
[0/1] Re-running CMake...-- Configuring done (0.7s)
-- Generating done (0.5s)
-- Build files have been written to: C:/src/ethernet_ip_test/extern/EIPScanner/build
[25/91] Building CXX object src/CMakeFiles/EIPScanner.dir/Debug/sockets/Platform.cpp.obj
FAILED: src/CMakeFiles/EIPScanner.dir/Debug/sockets/Platform.cpp.obj
C:\msys64\ucrt64\bin\c++.exe -DEIPScanner_EXPORTS -D_WIN32_WINNT=0x0600 -DCMAKE_INTDIR=\"Debug\" -I
C:/src/ethernet_ip_test/extern/EIPScanner/src -g -std=gnu++20 -MD -MT src/CMakeFiles/EIPScanner.dir
/Debug/sockets/Platform.cpp.obj -MF src\CMakeFiles\EIPScanner.dir\Debug\sockets\Platform.cpp.obj.d
-o src/CMakeFiles/EIPScanner.dir/Debug/sockets/Platform.cpp.obj -c C:/src/ethernet_ip_test/extern/E
IPScanner/src/sockets/Platform.cpp
C:/src/ethernet_ip_test/extern/EIPScanner/src/sockets/Platform.cpp: In member function 'virtual std
::string eipScanner::sockets::win32ErrorCategory::message(int) const':
C:/src/ethernet_ip_test/extern/EIPScanner/src/sockets/Platform.cpp:17:16: error: 'UINT8_MAX' was no
t declared in this scope
17 | char error[UINT8_MAX];
| ^~~~~~~~~
C:/src/ethernet_ip_test/extern/EIPScanner/src/sockets/Platform.cpp:9:1: note: 'UINT8_MAX' is define
d in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
8 | #include <windows.h>
+++ |+#include <cstdint>
9 |
C:/src/ethernet_ip_test/extern/EIPScanner/src/sockets/Platform.cpp:18:93: error: 'error' was not de
clared in this scope; did you mean 'perror'?
18 | auto len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast<DWORD>(c), 0,
error, sizeof(error), nullptr);
|
^~~~~
|
perror
[34/91] Building CXX object src/CMakeFiles/EIPScanner.dir/Debug/ConnectionManager.cpp.obj
ninja: build stopped: subcommand failed.
Environment (please complete the following information):
- OS: Windows 10, MSYS2 UCRT64
- Compiler: gcc
- Version 14.2.0
Additional context
I tried to fix this issue with the following patch:
diff --git a/src/sockets/Platform.cpp b/src/sockets/Platform.cpp
index ba5881a..175343f 100644
--- a/src/sockets/Platform.cpp
+++ b/src/sockets/Platform.cpp
@@ -6,9 +6,6 @@
#if defined(_WIN32) || defined(WIN32) || defined(_WIN64)
#include <windows.h>
-#if defined(__MINGW32__)
-#include <cstdint>
-#endif
namespace eipScanner {
namespace sockets {
This did allow EIPScanner to build on my UCRT64 development environment.
I was a bit hesitant to submit a PR for this patch because /src/sockets/Platform.cpp and /src/sockets/Platform.h have CRLF line endings checked into the repository. I wasn't sure how to deal with that anomaly.
Adding the keyword MINGW to this bug in case other variants of mingw have this build issue.