Build the NIF on Windows with Zig - #27
Open
misterjohannesson wants to merge 4 commits into
Open
misterjohannesson wants to merge 4 commits into
misterjohannesson wants to merge 4 commits into
Conversation
The compile hook ran only on linux and darwin, so on Windows rebar3 built nothing and then failed on the missing priv/ezstd_nif.so artifact. A Windows hook — matched as "(win32|windows)", since OTP 25+ reports the arch as x86_64-pc-windows — now runs build_win32.ps1, which fetches zstd at the commit build_deps.sh pins, compiles it and the NIF with zig cc/c++ for x86_64-windows-gnu and links priv/ezstd_nif.dll. Zig carries its own compiler and Windows headers, so it is the only tool the build needs; the NIF API is reached through the callback table erl_nif.h uses on Windows, so no import library is involved. rebar.config.script renames the artifact to .dll there. A CI workflow runs the suite on Linux, macOS and Windows.
The GitHub Actions workflow was the wrong place for it: this repository builds on Travis. Travis has no Erlang language support on Windows, so the job is a shell job that installs Erlang and Zig from Chocolatey and runs rebar3 compile and ct through the escript. The Linux jobs are unchanged.
… limit The link needs libc++, which Zig compiles from its bundled sources the first time it links it for a target, echoing some forty thousand warning lines from those sources while it does; Travis kills a job whose log passes 4 MB. The script now builds it once on a two-line file with the same flags, output kept unless it fails, and the real link then finds it in the cache and prints only its own diagnostics.
Travis stops a job that has printed nothing for ten minutes, and on its Windows VM the quiet libc++ build takes longer than that. The quiet runner now reports every thirty seconds that it is still going, and the zstd object compiles announce each directory.
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.
The compile hook ran only on linux and darwin, so on Windows rebar3 built nothing and then failed on the missing priv/ezstd_nif.so artifact. A Windows hook — matched as "(win32|windows)", since OTP 25+ reports the arch as x86_64-pc-windows — now runs build_win32.ps1, which fetches zstd at the commit build_deps.sh pins, compiles it and the NIF with zig cc/c++ for x86_64-windows-gnu and links priv/ezstd_nif.dll. Zig carries its own compiler and Windows headers, so it is the only tool the build needs; the NIF API is reached through the callback table erl_nif.h uses on Windows, so no import library is involved. rebar.config.script renames the artifact to .dll there.
A CI workflow runs the suite on Linux, macOS and Windows.