Repository navigation
chore: re-enable the Web Assembly CI job - #16135
basvandijk wants to merge 8 commits into
Conversation
|
How this was tested: Hosted runs. On my fork, a throwaway branch ran only this job, through this branch's
Run 2 used 8e0b12d, the current head of this branch. Run 1 used af58d75, an earlier revision without three later changes: the dependency of Local replay. I also generated the job's steps from Controls, on local builds of earlier revisions of this branch, and of this branch for the last one:
Not addressed here:
This PR is stacked on #16090 and contains its commit until that PR is merged. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t `lean.js` links Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…over#16137) This PR fixes the exit code of `lean` on 32-bit targets such as WebAssembly (wasm32) and i386 after options like `--version`, `--help` and `--deps`, after an unknown option or an invalid argument, when called without a file name, and after `--run`. In these cases `lean` exited with a code derived from a heap address instead of 0, 1 or the exit code of the program's `main`; a run that processes a file without `--run` was not affected, because it ends with `IO.Process.exit`. `lean` gets these codes as `UInt32` values from Lean code: as the error of `Lean.ShellOptions.process` (since leanprover#11434) and as the result of `Lean.shellMain`. `src/util/shell.cpp` read both with `unbox`, the second through `get_io_scalar_result<uint32>` from `src/util/io.h`. On 32-bit targets a boxed `UInt32` is a heap object rather than a scalar, so `unbox` returned half its address. This PR reads both with `unbox_uint32`, as the C code that the compiler generates for a `main` that returns `UInt32` does, and replaces `get_io_scalar_result`, which had no other use, with `get_io_uint32_result`. On 64-bit targets `unbox_uint32` is the same as `unbox`. This PR adds no test: `tests/misc/lean_version.sh`, `lean_help.sh` and `lean_ghash.sh` already check that `--version`, `--help` and `--githash` exit with 0, but CI runs them only on 64-bit targets, where the old code works. The `Web Assembly` job that leanprover#16135 re-enables runs six other tests. Claude Code, an AI coding assistant, helped with the investigation, the change, the testing and this description. I reviewed and checked them. Closes leanprover#16136 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This PR re-enables the
Web AssemblyCI job as a secondary, test-only job for nightlies, releases and PRs with therelease-cilabel, so that breakage of the WebAssembly build is caught again.#6424 disabled the job because V8 rejected
lean.wasm, which exports every symbol, once it had more than 100,000 exports. Node.js has accepted up to 1,000,000 since version 24, andlean.wasmhas 251,027 today, so the job now runs its tests with Node.js 26. It runs six tests, one at a time, as a WebAssemblyleanprocess can need 10 GiB of memory. It does not ship alinux_wasm32archive, does not gate merges, nightlies or releases, and is skipped when the target stage is 2, which the cross-compiled stage 1 cannot build. Its native 32-bit stage 0 now finds libuv through the i386pkg-config, does floating-point arithmetic with SSE aslean.hrequires, and uses 32 MiB thread stacks instead of the native default of 1 GiB, of which a 32-bit address space holds only a few. Linux jobs without Nix, which providesgdb, now skip the step that prints backtraces of core dumps.This PR also fixes the WebAssembly build itself:
IO.FS.renameIfNewcompiles for Emscripten, which has norenameat2: it checks that the target does not exist and then renames, which, unlike on other platforms, is not atomic.leanlauncher forlean.jsis generated again, now locatinglean.jsrelative to itself and passing its arguments quoted.emar, as GNUarwrites no symbol index for them, and builds onlyInit,StdandLean, which are whatlean.jslinks. Before, it also tried to buildLeanc, whoseLeanc.leanis not generated for Emscripten, and failed.LEAN_HEADER_SNAPSHOTS, which CI turns on) are turned off on Emscripten, as saving one needsdl_iterate_phdr, which Emscripten does not have.lean.js.lean.jsis linked only after the shell library, which it links directly, is rebuilt; before, an incremental build could link the old one.Stacked follow ups:
Claude Code, an AI coding assistant, helped with the investigation, the changes, the testing and this description. I reviewed and checked them.
Closes #16134
🤖 Generated with Claude Code