Repository navigation
fix(cli): install emscripten/esbuild before --just-compile delegation - #69
Merged
Merged
Conversation
PR #68's deploy job (`build_site.py`) now reaches the Rust binary via PATH, but the next call — `fastled <dir> --just-compile` — falls into the Python delegation branch of `lib.rs` WITHOUT calling `install::ensure_emscripten_installed()`. Python's emscripten lookup returns None on a fresh CI runner and compile fails with: Native compilation failed: Emscripten SDK not found. `compile_and_serve` (the non-just-compile path) does install the toolchain. Promote the same pre-step to also cover the just-compile delegation: whenever the CLI is about to invoke `python -m fastled.app` with a sketch directory (and we're not in `--init` / `--install` mode), ensure emscripten + esbuild are installed and export FASTLED_EMSCRIPTEN_DIR / FASTLED_ESBUILD_PATH for the subprocess. Local: bash lint clean, 119 unit tests pass.
The previous deploy failure after PR #69 was a manifest-parse error: parse manifest JSON from .../linux/x86_64/manifest.json: bad version entry 'versions': missing field `href` The clang-tool-chain-bins emscripten manifest is served in two shapes: * Linux / macOS — nested: {"latest": "4.0.21", "versions": {"4.0.21": {...}}} * Windows — inline: {"latest": "4.0.19", "4.0.19": {...}} The published `ctcb-manifest` crate's custom deserializer only handles the inline shape; it fails on Linux. Drop the dep, define local PartRef/VersionInfo/PlatformManifest types in `install.rs`, and write a custom Deserialize for PlatformManifest that accepts both shapes (prefer nested `versions` when present, fall back to inline keys). Verified locally by running `target/release/fastled <dummy> --just-compile` against the live Windows manifest — install proceeds past the parse and the only remaining error is a missing-sketch failure, unrelated to the toolchain bring-up. CI Linux deploy will now exercise the nested path.
After PR #69's earlier commits got the toolchain pre-step working, the deploy job advances further into the compile flow before failing: [WASM] Build failed: [Errno 2] No such file or directory: 'meson' File ".../internal_wasm_build.py", line 600, in ensure_meson_configured The FastLED C++ → WASM build invokes `meson` via subprocess (and meson runs `ninja` as its backend), but neither was declared as a dependency of the fastled package. CI runners don't have them on PATH; pip-install of fastled didn't provide them either. Both ship standalone executables when pip-installed (via `meson` and `ninja` PyPI packages), so adding them to `[project.dependencies]` puts them in `.venv/Scripts/` and on PATH for the subprocess. Net runtime deps go from 1 → 3 (`meson`, `ninja`, `zcmds_win32; Windows`), but all three are load-bearing for the compile critical path.
After meson + ninja landed, the deploy job's compile now reaches meson's
configure step and fails with:
meson.build:1:0: ERROR: Unknown compiler(s): [['clang-tool-chain-emcc']]
Running `clang-tool-chain-emcc --version` gave
"[Errno 2] No such file or directory: 'clang-tool-chain-emcc'"
FastLED's `ci/meson/wasm_cross_file.ini` names `clang-tool-chain-emcc`
/ `clang-tool-chain-em++` / `clang-tool-chain-emar` as the wasm
compiler/linker/archiver. Those are wrapper scripts shipped by the
`clang-tool-chain` PyPI package; earlier I dropped that dep when porting
the *install* logic to Rust, but the *wrappers* are still needed at
compile time.
Two changes:
* `pyproject.toml`: re-add `clang-tool-chain>=1.2.6` to runtime deps so
the wrapper scripts land in `.venv/Scripts/bin`. Comment explains why
it stays after the earlier dep purge.
* `crates/fastled-cli/src/lib.rs`: after Rust installs emscripten, also
export `CLANG_TOOL_CHAIN_DOWNLOAD_PATH` pointed at the toolchains root
(`~/.fastled/toolchains/`). The wrappers honor this env var and will
find the Rust-installed emscripten under
`<root>/emscripten/<plat>/<arch>/<ver>` rather than the default
`~/.clang-tool-chain/` layout.
Net runtime deps: 3 → 4 (`meson`, `ninja`, `clang-tool-chain`,
`zcmds_win32; Windows`). The architectural goal "Rust owns install" is
preserved — clang-tool-chain provides only the meson-compatible compiler
wrappers; the actual emscripten download still happens in Rust.
After commit 524dac4 (clang-tool-chain dep), the deploy job advances all the way through meson configuration — the wrappers find emscripten 4.0.21 via CLANG_TOOL_CHAIN_DOWNLOAD_PATH — and then fails the very first compile invocation with: PermissionError: [Errno 13] Permission denied File ".../emscripten/.../bin/clang" Some tar extractors apply the umask during unpack and drop the +x bit from shipped binaries (clang, wasm-ld, node, etc.) under bin/, emscripten/, libexec/. The previous Python implementation (`emscripten_archive.py::_extract_archive`) had a belt-and-suspenders chmod loop for exactly this; the Rust port (install.rs) dropped it. Restore it: walk staging/{bin,emscripten,libexec} recursively after `archive::extract_tar_zst` and add 0o111 to every file's mode. Gated on `#[cfg(unix)]` — no-op on Windows where the umask issue doesn't apply.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
deploy(Build Webpage) job onmainfails after PR #68 merged becausefastled <dir> --just-compile(driven bybuild_site.py) falls into the Python-delegation branch oflib.rsWITHOUT first installing the emscripten + esbuild toolchains. Python's emscripten lookup returns None on a fresh CI runner and compile aborts:compile_and_serve()(the non-just-compile path) already callsinstall::ensure_emscripten_installed()+ensure_esbuild_installed(). This PR promotes the same pre-step to also cover the just-compile delegation path: whenever the CLI is about to invokepython -m fastled.appwith a sketch directory (and we're not in--init/--installmode), ensure both toolchains and exportFASTLED_EMSCRIPTEN_DIR/FASTLED_ESBUILD_PATHfor the subprocess.Verification
bash lintcleanbash test— 119 unit tests passdeployjob in particular should turn green nowRefs #67, PR #68
🤖 Generated with Claude Code