Windows/MinGW support for emp (compile + non-network tests)#16
Open
hezhihua81 wants to merge 3 commits into
Open
Windows/MinGW support for emp (compile + non-network tests)#16hezhihua81 wants to merge 3 commits into
hezhihua81 wants to merge 3 commits into
Conversation
Make emp-toolkit compile under MinGW-w64 so it can go into primus-zk.dll for the Windows Node native addon. Scope is P1: headers compile + non-network crypto correctness. NetIO socket runtime (WSAStartup/closesocket/error codes) is deferred to P2. - win_compat.h: new central Windows shim (winsock2 headers, ssize_t/close via <sys/types.h>/<unistd.h>, usleep->Sleep, emp_wsa_init hook for P2). - net_io_channel.h / highspeed_net_io_channel.h: route POSIX socket includes through win_compat.h; cast setsockopt(TCP_NODELAY) args to const char* so they also compile under Winsock (no-op on POSIX). - emp-base.cmake: add WIN32 branch with a distributable ISA baseline (-maes -msse4.2 -mpclmul) instead of -march=native. - prg.h: on Windows seed std::random_device with the default token (OS CSPRNG) instead of "/dev/urandom", which throws on Windows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- constants.h / block.h: add #include <cstdint>. GCC 16 no longer pulls it in transitively, so uint8_t/uint64_t were undeclared. - win_compat.h: add an fmemopen() shim (MinGW CRT has none), backed by a Win32 temp file opened FILE_FLAG_DELETE_ON_CLOSE (auto-removed at process exit; binary mode matches fmemopen no-translation semantics). Needed by BristolFormat(const string) circuit loading. - circuit_file.h: include win_compat.h so the shim applies on Windows (no-op on POSIX, which keeps using the system fmemopen).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MinGW-w64 Windows support for emp-tool/-ot/-zk:
Verified on Windows 10: AES-NI/SSE4.2/PCLMUL intrinsics test suite all green under MinGW; real mpctls attestation passes through a MinGW-built primus-zk.dll. Branch = current main + 2 commits (merge already reconciled).
Needed by primus-labs/pado-core windows-build (primus-zk.dll for zktls-core-sdk).
🤖 Generated with Claude Code