From 7a28d5d624ea5bd74599a63a2bc6d84b6e9cfb44 Mon Sep 17 00:00:00 2001 From: Taylor Beseda Date: Wed, 1 Jul 2026 13:10:13 -0600 Subject: [PATCH] chore(docs): add lld mention for macOS to BUILD.md (#102) * chore(docs): BUILD mentions lld for macOS * Update BUILD.md --- BUILD.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/BUILD.md b/BUILD.md index ee34081..e80e478 100644 --- a/BUILD.md +++ b/BUILD.md @@ -56,6 +56,7 @@ You need: - `git` - `make` - `clang` with wasm32-capable support +- `lld` (provides `wasm-ld`) - `deno` Equivalent packages are fine if your package manager uses different names. @@ -71,10 +72,10 @@ including `git` and `make`. xcode-select --install ``` -Then install LLVM and Deno with Homebrew: +Then install LLVM, LLD, and Deno with Homebrew: ```sh -brew install llvm deno +brew install llvm lld deno ``` Use Homebrew LLVM before Apple's system `clang` when building `@bomb.sh/tty`: @@ -161,11 +162,12 @@ clang --version deno --version ``` -For a quick wasm-target smoke test, make sure `clang` can compile for `wasm32`: +For a quick wasm-target smoke test, make sure `clang` can compile and link for +`wasm32`: ```sh -clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o -rm -f /tmp/clayterm-wasm-test.o +clang --target=wasm32 -nostdlib -Wl,--no-entry -x c /dev/null -o /tmp/clayterm-wasm-test.wasm +rm -f /tmp/clayterm-wasm-test.wasm ``` On macOS, if `which clang` still points to `/usr/bin/clang` and the wasm test @@ -253,12 +255,13 @@ Recovery: - make sure you are using an LLVM/Clang build with wasm support - on macOS, prefer the Homebrew `llvm` toolchain over `/usr/bin/clang` +- on macOS, install `lld`; it provides `wasm-ld` - on Linux/WSL2, make sure both `clang` and `lld` are installed - rerun the wasm smoke test: ```sh -clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o -rm -f /tmp/clayterm-wasm-test.o +clang --target=wasm32 -nostdlib -Wl,--no-entry -x c /dev/null -o /tmp/clayterm-wasm-test.wasm +rm -f /tmp/clayterm-wasm-test.wasm ``` If the smoke test fails, fix the toolchain first and only then rerun `make`. -- 2.51.2