new(emscripten.org): C/C++ → WASM (Top 300 #594) - #13065
Conversation
LLVM-based toolchain wrapping pantry's llvm.org clang to target WebAssembly. Python-based — no traditional make install. Copy the tree + seed .emscripten config pointing at pantry's llvm.org/nodejs. Closes part of pkgxdev#99 (holdout pkgxdev#594).
emscripten 5.0.x dropped the bare-name entry points (emcc, em++, emar, etc.) in favor of Python scripts with .py suffix. The previous recipe assumed bare names and produced empty bin/, leading to provides: audit failure 'missing executables'. Generate a small shell shim per tool that invokes the .py via pantry's pinned python3.
|
Draft — emscripten 5.0.x requires Two paths to unblock:
Going with option 1 as a follow-up. The recipe wiring (LLVM_ROOT, NODE_JS, runtime-relocatable wrappers) is in place; just needs BINARYEN_ROOT pointing at the new binaryen pantry install. Deferring. |
Test failed with: emcc: error: BINARYEN_ROOT not set in config, and `wasm-opt` not found in PATH Pantry's llvm.org does not ship wasm-opt — that tool lives in WebAssembly/binaryen (added by PR pkgxdev#13080, currently green). Wire binaryen as a runtime + build dep and point BINARYEN_ROOT at it in both runtime.env and the seeded .emscripten config. Mirrors how homebrew/nixpkgs configure emscripten (separate binaryen install referenced via BINARYEN_ROOT).
pantry's convention for non-domain projects is github.com/<owner>/<repo>; the binaryen recipe lives at projects/github.com/WebAssembly/binaryen/. Previous commit used 'WebAssembly/binaryen' which libpkgx rejected: Error: pkg not found: WebAssembly/binaryen NB: this PR now hard-depends on pkgxdev#13080 (new(WebAssembly/binaryen)) being merged first — that PR is green and mergeable.
|
CI was failing with: Root cause: pantry's I have:
This mirrors how homebrew and nixpkgs wire emscripten -> binaryen (separate install, referenced via Merge ordering: this PR now hard-depends on #13080 landing first. Until then, CI will fail with |
The .emscripten config was written via an unquoted heredoc using
${{deps...prefix}} — pkgx renders the {{...}} but the leading $ stays
literal, so NODE_JS became "$/opt/nodejs.org/.../bin/node" and emcc
couldn't find node (test failed at emcc --version). In a build script
the mustache must be {{...}} with no $ (the ${{...}} form is only for
env: blocks). Drop the $ on the 4 heredoc assignments.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oints
Three issues, all reproduced on x86_64:
1. `emcc --version | head -1` under `set -o pipefail`: on a fresh cache
emcc prints several lines; `head` closes the pipe after line 1, emcc
(CPython) hits BrokenPipeError and exits 120 (CPython's "error flushing
stdout on shutdown"), which pipefail turns into a test failure. Drop the
`| head -1`.
2. Read-only cache: the default EM_CACHE ($EMSCRIPTEN_ROOT/cache) is under
the bottle prefix and can't be written, so the first compile can't build
system libs. Point EM_CACHE at a writable dir — in the test (mktemp) and,
for end users, default it in the wrappers to
${XDG_CACHE_HOME:-$HOME/.cache}/emscripten when unset.
3. Missing bare entrypoints: emscripten spawns $EMSCRIPTEN_ROOT/{emcc,em++,
emar,emranlib} directly (tools/shared.py) when building system libs, but
the tag ships only <tool>.py and the recipe only made bin/ wrappers →
FileNotFoundError. Emit bare top-level wrappers too.
Validated on x86_64 under a read-only prefix: emcc --version, then
emcc hello.c -o hello.js builds the system libs into the writable cache,
produces hello.js/.wasm, and node runs it (exit 0).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wraps pantry llvm.org clang for WebAssembly targeting. Part of #99.
🤖 Generated with Claude Code