AdvancedLDC 1.43 setup

LDC 1.43 setup

An earlier design kept two LDC binaries: 1.42 for the host and the CLI, 1.43 for wasm-eh. That split was real — 1.42 does not emit try_table — and it was expensive. Two PATHs, two toolchain folders, a Windows-only setenv.ps1 for the host, and a standing invitation to compile wasm with the host compiler “just this once.” The standing invitation is how a module links and then ABORT:s on the first catch.

There is now one LDC 1.43+ for the CLI, the vibe.0 host, and the wasm-eh module. findHostLdc and findWasmLdc are findLdc. Wasm and host still clear DFLAGS and DC; they do not share .o files. They share a compiler.

Discovery is the same on Windows, macOS, and Linux. A consumer does not need a riscv-dev or riscv-compilers tree. Environment (SVELTE_D_LDC, LDC, WASM_LDC, DC) wins if the binary’s --version is 1.43 or later. Then SVELTE_D_TOOLCHAINS or ~/.svelte-d/toolchains/ldc2-1.43*. Then, only if those folders happen to exist on an author machine, a nearby ldc2-build or toolchains/ldc2-1.43*. Then PATH, still version-checked. Only the first identity line of --version counts. A 1.43 binary whose banner later says it was built with 1.42 is accepted. A 1.42 is not.

bunx svelte-d setup performs that walk and, if nothing matches, downloads official ldc-developers/ldc 1.43.0-beta1 for the current OS and architecture (SVELTE_D_LDC_VERSION overrides). It then downloads the CI-built fork wasm-opt (GitHub Release wasm-opt-svelte-d, one archive per triple: darwin-arm64, darwin-x86_64, linux-x86_64, linux-aarch64, windows-x86_64) into binaryen-build/<os-arch>/ and ~/.svelte-d/toolchains/binaryen-svelte-d. svelte-d wasm / build pull the same archive if the binary is missing. A successful pull does not cmake-rebuild Binaryen. That is the same “fetch a toolchain tarball” path as LDC. Official Binaryen ≥123 (SVELTE_D_BINARYEN_VERSION, default version_123) is only the fallback so try_table still parses if the fork release is missing. Ubuntu apt 108 cannot. Windows .7z (LDC) needs 7-Zip; the wasm-opt archives are .tar.gz.

The etcimon/binaryen submodule (binaryen/, branch svelte-d) is the Flatten-try_table source. .github/workflows/wasm-opt.yml compiles it on those five triples. SVELTE_D_BUILD_WASM_OPT=1 (or bun run build-wasm-opt) still builds from the submodule when CMake is present. Stock 123 and 132 still UNREACHABLE in Flatten.cpp on --asyncify. Live libwasm and vibe.0 checkouts are dub add-local’d. openssl ~>3.3.4 is cloned from github.com/etcimon/openssl when no checkout exists — vibe-0 1.2.1’s library-manual-link configuration is not on the DUB registry package. See Getting Started.