Skip to content

wasm: build usr/gen_init_cpio on macOS hosts - #55

Open
kilian-ai wants to merge 1 commit into
tombl:wasmfrom
kilian-ai:pr/wasm-macos-host-build
Open

kilian-ai wants to merge 1 commit into
tombl:wasmfrom
kilian-ai:pr/wasm-macos-host-build

Conversation

@kilian-ai

@kilian-ai kilian-ai commented Sep 27, 2026 •

Copy link
Copy Markdown

Now that #56 skips scripts/mod for wasm-ld, one host tool still stops a macOS build of vmlinux.wasm: usr/gen_init_cpio. Darwin has neither copy_file_range() nor O_LARGEFILE:

usr/gen_init_cpio.c:460:16: error: call to undeclared function 'copy_file_range' [...]
usr/gen_init_cpio.c:677:31: error: use of undeclared identifier 'O_LARGEFILE'

On Darwin only, usr/Makefile now force-includes a small compat header (arch/wasm/scripts/macos-host-compat.h) for that one host program:

  • copy_file_range() becomes a read/write loop with the same return contract;
  • O_LARGEFILE is defined as 0, since off_t is already 64-bit on Darwin.

There are no target code changes, and builds on other hosts are unchanged.

Tested on macOS 26 (Apple Silicon) with GNU Make 4.4.1 (Homebrew make) and Homebrew LLVM 19.1.7, the same major version as llvmPackages_19 in flake.nix. On top of f2a512c, make mrproper && make defconfig && make vmlinux.wasm succeeds. Without this change the same build fails with the errors above.

(This PR originally also skipped scripts/mod on Darwin; #56 covers that for every host, so I dropped that part.)

🤖 Generated with Claude Code

Darwin lacks copy_file_range() and O_LARGEFILE, so the gen_init_cpio
host program fails to build and a macOS build of vmlinux.wasm stops in
usr/. Force-include a small compat header for that host program on
Darwin only: copy_file_range() becomes a read/write loop with the same
return contract, and O_LARGEFILE is 0 (off_t is already 64-bit there).
Other hosts are unchanged.

Tested on macOS 26 (Apple Silicon) with GNU Make 4.4.1 and Homebrew
LLVM 19.1.7 (matching flake.nix): defconfig + vmlinux.wasm builds on
top of f2a512c, which no longer needs scripts/mod.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kilian-ai
kilian-ai force-pushed the pr/wasm-macos-host-build branch from 238f842 to f1a72f8 Compare September 29, 2026 19:07
@kilian-ai kilian-ai changed the title wasm: build on macOS hosts wasm: build usr/gen_init_cpio on macOS hosts Sep 29, 2026

This branch has not been deployed

No deployments
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