Skip to content

Commit f31f68d

Browse files
authored
Merge pull request #3358 from o1-labs/leon/wasm-macos
fix: wasm build on macOS
2 parents a26da0e + d262323 commit f31f68d

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

.cargo/config.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,10 @@ xtask = "run --package xtask --"
55
# Required to avoid undefined symbols when building dylib on MacOS
66
# (e.g. required for at the time of writing).
77
[target.aarch64-apple-darwin]
8-
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"]
8+
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"]
9+
10+
[target.wasm32-unknown-unknown]
11+
rustflags = [
12+
"-C", "target-feature=+atomics,+bulk-memory,+mutable-globals",
13+
"-C", "link-arg=--max-memory=4294967296",
14+
]

.github/workflows/wasm.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ on:
1010
jobs:
1111
build-wasm:
1212
name: Build WebAssembly code
13-
14-
runs-on: ["ubuntu-latest"]
15-
1613
strategy:
1714
matrix:
18-
rust_toolchain_version: ["nightly-2024-09-05"]
15+
os: [ubuntu-latest, macos-15]
16+
rust_toolchain_version: ['nightly-2024-09-05']
17+
18+
runs-on: ${{ matrix.os }}
1919

2020
steps:
2121
- name: Checkout repository

plonk-wasm/config.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

xtask/src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ fn build_kimchi_stubs(target_dir: Option<&str>, offline: bool) -> Result<()> {
152152
}
153153

154154
fn build_wasm(out_dir: &str, target: Target, rust_version: RustVersion) -> Result<()> {
155-
const RUSTFLAGS: &str = "-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296";
156-
157155
let cargo_target_dir = env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string());
158156
let artifact_dir = PathBuf::from(format!("{cargo_target_dir}/bin"));
159157

@@ -204,7 +202,6 @@ fn build_wasm(out_dir: &str, target: Target, rust_version: RustVersion) -> Resul
204202
let status = cmd
205203
.args(args)
206204
.args(target_args)
207-
.env("RUSTFLAGS", RUSTFLAGS)
208205
.status()
209206
.context("Failed to execute wasm-pack")?;
210207

0 commit comments

Comments
 (0)