Can't build on M3 MacPro with sold linker
> $ cargo install --path .
Installing bacon v2.14.3-dev (/Users/fcoury/code/bacon)
Updating crates.io index
Compiling proc-macro2 v1.0.78
Compiling unicode-ident v1.0.12
Compiling libc v0.2.153
Compiling autocfg v1.1.0
Compiling thiserror v1.0.57
Compiling cfg-if v1.0.0
Compiling serde v1.0.197
Compiling parking_lot_core v0.9.9
Compiling memchr v2.7.1
Compiling crossbeam-utils v0.8.19
Compiling regex-syntax v0.8.2
Compiling once_cell v1.19.0
Compiling smallvec v1.13.1
Compiling scopeguard v1.2.0
Compiling tinyvec_macros v0.1.1
Compiling gix-trace v0.1.7
Compiling rayon-core v1.12.1
Compiling tinyvec v1.6.0
Compiling crc32fast v1.4.0
Compiling fastrand v2.0.1
Compiling adler v1.0.2
Compiling same-file v1.0.6
Compiling bitflags v2.4.2
Compiling either v1.10.0
Compiling walkdir v2.4.0
Compiling lock_api v0.4.11
Compiling aho-corasick v1.1.2
Compiling miniz_oxide v0.7.2
Compiling bytesize v1.3.0
error: failed to run custom build command for `thiserror v1.0.57`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/thiserror-5ab653d5974c1640/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rayon-core v1.12.1`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/rayon-core-2c5ae3065a5d199f/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to run custom build command for `serde v1.0.197`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/serde-32f36e526d05b2fa/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
error: failed to run custom build command for `parking_lot_core v0.9.9`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/parking_lot_core-4a7529d07e68ff4c/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to run custom build command for `crossbeam-utils v0.8.19`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/crossbeam-utils-eeed6c8973fa880e/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to run custom build command for `proc-macro2 v1.0.78`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/proc-macro2-296ff4b34021689d/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to run custom build command for `crc32fast v1.4.0`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/crc32fast-57edd767e203b1e3/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
error: failed to run custom build command for `libc v0.2.153`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/libc-7d3c3772beff9ff0/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to run custom build command for `lock_api v0.4.11`
Caused by:
process didn't exit successfully: `/Users/fcoury/code/bacon/target/release/build/lock_api-10916c91955e0afb/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to compile `bacon v2.14.3-dev (/Users/fcoury/code/bacon)`, intermediate artifacts can be found at `/Users/fcoury/code/bacon/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
For future reference, this only happened when I had the sold linker configured. Removing it worked fine.
This was my .cargo/config.toml:
> $ cat ~/.cargo/config.toml
[target.aarch64-apple-darwin]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/ld64.mold"]
"sold linker" ? Is that mold ?
Yes and no. The macOS version of mold is called sold and was a paid version until recently:
https://github.com/bluewhalesystems/sold
Ok. You may keep the issue open if you think it could be useful for bacon to be built using this linker. But I won't work on it myself as I don't have a mac.
Done, thank you! BTW sold also works in Linux if you want to take a look :-)