Skip to content

Windows/MinGW support for emp (compile + non-network tests)#16

Open
hezhihua81 wants to merge 3 commits into
mainfrom
windows-build
Open

Windows/MinGW support for emp (compile + non-network tests)#16
hezhihua81 wants to merge 3 commits into
mainfrom
windows-build

Conversation

@hezhihua81

Copy link
Copy Markdown
Collaborator

MinGW-w64 Windows support for emp-tool/-ot/-zk:

  • win_compat.h: winsock2 header ordering, usleep shim, WSAStartup hook
  • emp-base.cmake Windows branch; fixed -march baseline (-maes -msse4.2 -mpclmul)
  • prg.h: random_device seeding fix on Windows (default token)
  • GCC 16 fixes: missing cstdint include, fmemopen shim

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

hezhihua81 and others added 3 commits July 8, 2026 11:19
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant