-
Notifications
You must be signed in to change notification settings - Fork 16.1k
protobuf 3.18.0 broken for Windows when building with MinGW-w64 #8992
Copy link
Copy link
Closed
microsoft/vcpkg
#22369Labels
platform relatedAny issue releated to specific platform or OSAny issue releated to specific platform or OSwindows
Description
protobuf 3.18.0 fails to build on Windows with MinGW-w64 GCC with the following errors:
R:/winlibs64-10.3.0/protobuf-3.18.0/src/google/protobuf/io/zero_copy_stream_impl.cc:108:28: error: 'F_GETFL' was not declared in this scope
108 | int flags = fcntl(file_, F_GETFL);
| ^~~~~~~
R:/winlibs64-10.3.0/protobuf-3.18.0/src/google/protobuf/io/zero_copy_stream_impl.cc:108:15: error: 'fcntl' was not declared in this scope
108 | int flags = fcntl(file_, F_GETFL);
| ^~~~~
R:/winlibs64-10.3.0/protobuf-3.18.0/src/google/protobuf/io/zero_copy_stream_impl.cc:109:13: error: 'O_NONBLOCK' was not declared in this scope
109 | flags &= ~O_NONBLOCK;
| ^~~~~~~~~~
R:/winlibs64-10.3.0/protobuf-3.18.0/src/google/protobuf/io/zero_copy_stream_impl.cc:110:16: error: 'F_SETFL' was not declared in this scope
110 | fcntl(file_, F_SETFL, flags);
| ^~~~~~~
The solution is to replace _MSC_VER with _WIN32 in src/google/protobuf/io/zero_copy_stream_impl.cc.
Apparently a false assumption was made _MSC_VER is always set on the Windows platform, but that is only the case when building with MSVC. On MSVC and MinGW gcc and clang _WIN32 is always defined however.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
platform relatedAny issue releated to specific platform or OSAny issue releated to specific platform or OSwindows