Skip to content

fix(cli): install emscripten/esbuild before --just-compile delegation - #69

Merged
zackees merged 5 commits into
mainfrom
fix/just-compile-toolchain-install
May 13, 2026
Merged

zackees merged 5 commits into
mainfrom
fix/just-compile-toolchain-install

Conversation

@zackees

@zackees zackees commented May 13, 2026

Copy link
Copy Markdown
Member

Summary

The deploy (Build Webpage) job on main fails after PR #68 merged because fastled <dir> --just-compile (driven by build_site.py) falls into the Python-delegation branch of lib.rs WITHOUT first installing the emscripten + esbuild toolchains. Python's emscripten lookup returns None on a fresh CI runner and compile aborts:

Native compilation failed: Emscripten SDK not found.

compile_and_serve() (the non-just-compile path) already calls install::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 invoke python -m fastled.app with a sketch directory (and we're not in --init / --install mode), ensure both toolchains and export FASTLED_EMSCRIPTEN_DIR / FASTLED_ESBUILD_PATH for the subprocess.

Verification

  • bash lint clean
  • bash test — 119 unit tests pass
  • CI green — deploy job in particular should turn green now

Refs #67, PR #68

🤖 Generated with Claude Code

zackees added 5 commits May 12, 2026 21:14
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.
@zackees
zackees merged commit cc9aa02 into main May 13, 2026
25 checks passed
@zackees
zackees deleted the fix/just-compile-toolchain-install branch November 5, 2026 05:51
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