Skip to content

new(emscripten.org): C/C++ → WASM (Top 300 #594)#13065

Draft
tannevaled wants to merge 8 commits into
pkgxdev:mainfrom
tannevaled:new/emscripten
Draft

new(emscripten.org): C/C++ → WASM (Top 300 #594)#13065
tannevaled wants to merge 8 commits into
pkgxdev:mainfrom
tannevaled:new/emscripten

Conversation

@tannevaled
Copy link
Copy Markdown
Contributor

Wraps pantry llvm.org clang for WebAssembly targeting. Part of #99.

🤖 Generated with Claude Code

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.
@tannevaled tannevaled marked this pull request as draft May 29, 2026 13:26
@tannevaled
Copy link
Copy Markdown
Contributor Author

Draft — emscripten 5.0.x requires wasm-opt (from binaryen) at link time, and pantry doesn't currently ship binaryen.

Two paths to unblock:

  1. Add a separate binaryen recipe to pantry first (modest CMake build of github.com/WebAssembly/binaryen)
  2. Bundle a pre-built wasm-opt with the emscripten recipe (vendored — against project policy)

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.
@tannevaled
Copy link
Copy Markdown
Contributor Author

CI was failing with:

emcc: error: BINARYEN_ROOT not set in config (/opt/emscripten.org/v5.0.7/.emscripten), and `wasm-opt` not found in PATH

Root cause: pantry's llvm.org does not ship wasm-opt. That tool lives in WebAssembly/binaryen, added by #13080 (which is currently green and mergeable).

I have:

  1. Added github.com/WebAssembly/binaryen: '*' as a runtime + build dep
  2. Set BINARYEN_ROOT in both runtime.env and the seeded .emscripten config

This mirrors how homebrew and nixpkgs wire emscripten -> binaryen (separate install, referenced via BINARYEN_ROOT).

Merge ordering: this PR now hard-depends on #13080 landing first. Until then, CI will fail with pkg not found: github.com/WebAssembly/binaryen. Once #13080 merges, a rebase / no-op push here should turn this PR green.

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