Skip to content

Add Vinix as a build target - #250

Open
metif12 wants to merge 2 commits into
vlang:mainfrom
metif12:vinix-support
Open

metif12 wants to merge 2 commits into
vlang:mainfrom
metif12:vinix-support

Conversation

@metif12

@metif12 metif12 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

build.vsh now has a 'vinix' key in ignore_dirs. It lists only uptime, rather than sharing the macOS list: stat and sync are excluded on macOS because the BSD syscall surface differs from Linux, and Vinix follows POSIX closely enough that both build there. Without the key, the dictionary lookup fell through to an empty list — which read as "build everything" and would have attempted the Windows-excluded Unix set alongside it.

A CI job cross-compiles all 87 tools for the target, since GitHub has no Vinix runner.

That job is not decoration. It is what found that timeout did not compile on any Unix. timeout.v passed mut &p to terminate_process, which only the Windows variant declares as mut; the _nix and _default variants rejected it. Linux, macOS and Vinix were all broken while Windows CI was green, and the -Wimpure-v gate never saw it because only Windows builds the directory. All three variants now take mut p &os.Process so the call site is uniform, and the Windows comment explaining why the pointer is mutable is kept rather than deleted as redundant.

V's side needed nothing: $if vinix, _vinix.c.v file suffixes and -os vinix all already work, and _nix.c.v files are selected on Vinix because the suffix allowlist only excludes them on Windows. I verified that with a probe rather than assuming it.

Verified: 87 of 87 tools cross-compile for Vinix, timeout builds for all four targets (windows, linux, macos, vinix), and the Windows build is unchanged.

Two things I want to flag, not bury

The CI job parses build.vsh with shell text tools to read the ignore list, so the two cannot drift. That parsing is now verified: it extracts exactly uptime, skips exactly 1 of 87, and drops the key word itself. But it is still a shell grep reading a V source file, which is a real fragility — a restructured map literal would break it. A stronger design would have build.vsh emit the list on request (v run build.vsh --print-ignored), which is a bigger change than this PR should carry. Worth a follow-up.

It cross-compiles; it does not run. There is no Vinix runner, so nothing in CI executes the resulting binaries, and a tool that compiles but misbehaves on Vinix will still pass. That is a meaningful gap, and the job says so in a comment rather than implying coverage it does not have.

build.vsh now has a 'vinix' key in ignore_dirs. It lists only uptime, rather than sharing the macOS list: stat and sync are excluded on macOS because the BSD syscall surface differs from Linux, and Vinix follows POSIX closely enough that both do build there. Without the key the dictionary lookup fell through to an empty list, so Vinix would have built the Windows-excluded Unix set as well as everything else at once. A CI job cross-compiles all 87 tools for the target, since GitHub has no Vinix runner. That job is not decoration: it is what found that timeout did not compile on any Unix. timeout.v passed 'mut &p' to terminate_process, which only the Windows variant declares as mut, so the nix and default variants rejected it. Linux, macOS and Vinix were all broken while Windows CI was green. All three variants now take 'mut p &os.Process' so the call site is uniform, and the Windows comment explaining why the pointer is mutable is kept. Verified: 87 of 87 tools cross-compile for vinix, timeout builds for all four targets, and the Windows build is unchanged.
Rebasing this onto main surfaced that main's tip commit c6cbc32
("timeout: fix errors") does not build. It changed every terminate_process
from `p os.Process` to a value, but left the two calls that mutate it:

    src/timeout/timeout_windows.c.v:13:3: error: `p` is immutable, declare it
        with `mut` to make it mutable
    src/timeout/timeout_windows.c.v:15:3: error: `p` is immutable, declare it
        with `mut` to make it mutable

    terminate_process(p os.Process, ...)   // p.signal_term()
    terminate_process(p os.Process, ...)   // p.signal_kill()

Verified on pristine main: `v -o timeout.exe src/timeout` fails with exactly
those two errors, so timeout does not build for Windows at all right now.
Nothing caught it because CI has been failing inside the V bootstrap before
it reaches this.

The comment above the function on main already says why this cannot be a
value - "A pointer, because signalling a process changes it. Passing it by
value ... made the compiler reference it for us and then reject that as
deprecated automatic referencing." - so the fix is to make the signature
match the comment rather than the other way round.

So this keeps the mut-pointer signature across all three platform variants
and passes `mut &p` at both call sites, which is what this branch already
did before the rebase. The signatures have to agree: they are selected per
platform from one shared call site, so a mismatch is a build break on
whichever target picks the odd one out.

Verified after the change: timeout builds, and src/timeout passes (1/1)
with a real GNU timeout on PATH to compare against. v fmt -verify is clean
on all four files. The diff is five lines - three signatures and two call
sites - with no other change.
@metif12

metif12 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Two things changed after rebasing onto main, and one claim in this description is now wrong.

The timeout half moved to #263

This branch was written against the tree before c6cbc320b6, and fixed the then-inconsistent timeout by making all three terminate_process variants take mut p &os.Process. That fix is still correct and is now needed on main for a stronger reason than the one given here — but main's subsequent commit broke the Windows build of timeout outright:

src/timeout/timeout_windows.c.v:13:3: error: `p` is immutable, declare it with `mut` to make it mutable

So the fix is no longer part of this PR; it is #263, on its own so it can land ahead of this one and so main stops shipping a build break. Once #263 merges, this branch's src/timeout commit rebases away and this PR is left carrying only the Vinix build target — .github/workflows/ci.yml and build.vsh. I have confirmed that by rebasing onto #263: the diff comes out as exactly those two files.

The description line "the Windows build is unchanged" is no longer true and I am not able to re-verify the "87 of 87 tools cross-compile for Vinix" claim from here — there is no Vinix toolchain on this machine, and the vinix-cross-build job that would check it is the thing this PR adds. That job is the right place for that claim to live.

The reasoning about why the pointer is needed is still the reason, and it is now also the fix on main: signalling a process mutates it, and a value makes the compiler insert an automatic reference that it then rejects as deprecated. The comment above terminate_process already said so; the signature had drifted away from it.

build.vsh no longer collides with #256

Both this branch and #256 added a 'vinix': ['uptime'] entry to the per-platform exclusion map, which conflicted. Rather than have one delete the other at merge time, #256 now no longer touches vinix at all — its diff is only the Windows exclusion list, which is what that PR is about — and the entry plus its explanation stays here. The two merge in either order; I checked with git merge-tree, which is clean both ways.

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