Skip to content

Commit 90680a5

Browse files
authored
fix macos intel release build issue (#159)
* fix macos intel Not enough free space * only use flags on macos x64 * ubuntu 22 > 24
1 parent 8b38b47 commit 90680a5

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/ci_nix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
# macos-15-intel uses x86-64 machine, macos-14 and macos-15 uses aarch64
19-
os: [macos-15-intel, macos-15, ubuntu-22.04, ubuntu-24.04-arm]
19+
os: [macos-15-intel, macos-15, ubuntu-24.04, ubuntu-24.04-arm]
2020
runs-on: ${{ matrix.os }}
2121
steps:
2222
- uses: actions/checkout@v4

build.roc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ run! = |maybe_roc|
5151

5252
build_stub_app_lib!(roc_cmd, stub_lib_path)?
5353

54-
cargo_build_host!({})?
54+
cargo_build_host!(os_and_arch)?
5555

5656
rust_target_folder = get_rust_target_folder!({})?
5757

@@ -98,12 +98,21 @@ get_rust_target_folder! = |{}|
9898

9999
Ok("target/release/")
100100

101-
cargo_build_host! : {} => Result {} _
102-
cargo_build_host! = |{}|
101+
cargo_build_host! : OSAndArch => Result {} _
102+
cargo_build_host! = |os_and_arch|
103103

104104
info!("Building rust host ...")?
105105

106-
Cmd.exec!("cargo", ["build", "--release"])
106+
cmd = Cmd.new("cargo") |> Cmd.args(["build", "--release"])
107+
108+
# Apply RUSTFLAGS only on macOS x64 to fix "Not enough free space" linker error
109+
cmd_with_flags =
110+
when os_and_arch is
111+
MacosX64 -> cmd |> Cmd.env("RUSTFLAGS", "-C link-arg=-Wl,-headerpad,0x1000")
112+
_ -> cmd
113+
114+
cmd_with_flags
115+
|> Cmd.exec_cmd!()
107116
|> Result.map_err(ErrBuildingHostBinaries)
108117

109118
copy_host_lib! : OSAndArch, Str => Result {} _

0 commit comments

Comments
 (0)