Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macos build tip #7581

Merged
merged 1 commit into from
Feb 5, 2025
Merged
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
27 changes: 10 additions & 17 deletions BUILDING_FROM_SOURCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Or even run it in your local Docker environment [Developing inside a Container](

## Using Nix

On MacOS and Linux, we highly recommend Using [nix](https://nixos.org/download.html) to quickly install all dependencies necessary to build roc.
On MacOS and Linux, we highly recommend using [nix](https://nixos.org/download.html) to quickly install all dependencies necessary to build roc.

:warning: If you tried to run `cargo` in the repo folder before installing nix, make sure to execute `cargo clean` first. To prevent you from executing `cargo` outside of nix, tools like [direnv](https://github.com/nix-community/nix-direnv) and [lorri](https://github.com/nix-community/lorri) can put you in a nix shell automatically when you `cd` into the directory.

Expand Down Expand Up @@ -89,22 +89,6 @@ Alternatively, you can use `cargo test --no-fail-fast` or `cargo test -p specifi

For emitting LLVM IR for debugging purposes, the `--emit-llvm-ir` flag can be used.

### libxcb libraries

You may see an error like this during builds:

```text
/usr/bin/ld: cannot find -lxcb-render
/usr/bin/ld: cannot find -lxcb-shape
/usr/bin/ld: cannot find -lxcb-xfixes
```

If so, you can fix it like so:

```sh
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
```

### libz libzstd libraries

You may see an error like this during builds:
Expand All @@ -120,6 +104,15 @@ If so, you can fix it like so:
sudo apt-get install libz-dev libzstd-dev
```

#### Macos zstd not found

If you still hit `ld: library 'zstd' not found` even after doing `brew install zstd z3`,
add these lines to `.cargo/config.toml`:
```
[target.aarch64-apple-darwin]
rustflags = ["-C", "link-args=-L/opt/homebrew/lib"]
```

### Zig

**version: 0.13.0**
Expand Down