···5656- `git`
5757- `make`
5858- `clang` with wasm32-capable support
5959+- `lld` (provides `wasm-ld`)
5960- `deno`
60616162Equivalent packages are fine if your package manager uses different names.
···7172xcode-select --install
7273```
73747474-Then install LLVM and Deno with Homebrew:
7575+Then install LLVM, LLD, and Deno with Homebrew:
75767677```sh
7777-brew install llvm deno
7878+brew install llvm lld deno
7879```
79808081Use Homebrew LLVM before Apple's system `clang` when building `@bomb.sh/tty`:
···161162deno --version
162163```
163164164164-For a quick wasm-target smoke test, make sure `clang` can compile for `wasm32`:
165165+For a quick wasm-target smoke test, make sure `clang` can compile and link for
166166+`wasm32`:
165167166168```sh
167167-clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o
168168-rm -f /tmp/clayterm-wasm-test.o
169169+clang --target=wasm32 -nostdlib -Wl,--no-entry -x c /dev/null -o /tmp/clayterm-wasm-test.wasm
170170+rm -f /tmp/clayterm-wasm-test.wasm
169171```
170172171173On macOS, if `which clang` still points to `/usr/bin/clang` and the wasm test
···253255254256- make sure you are using an LLVM/Clang build with wasm support
255257- on macOS, prefer the Homebrew `llvm` toolchain over `/usr/bin/clang`
258258+- on macOS, install `lld`; it provides `wasm-ld`
256259- on Linux/WSL2, make sure both `clang` and `lld` are installed
257260- rerun the wasm smoke test:
258261259262```sh
260260-clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o
261261-rm -f /tmp/clayterm-wasm-test.o
263263+clang --target=wasm32 -nostdlib -Wl,--no-entry -x c /dev/null -o /tmp/clayterm-wasm-test.wasm
264264+rm -f /tmp/clayterm-wasm-test.wasm
262265```
263266264267If the smoke test fails, fix the toolchain first and only then rerun `make`.