Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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`:
Expand Down Expand Up @@ -161,11 +162,11 @@ 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
Expand Down Expand Up @@ -253,12 +254,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`.
Expand Down