mold
mold copied to clipboard
mold: fatal: unknown command line option: -arch
I am trying to cross compile my rust code to x86_64-unknown-linux-musl
I have tried in .cargo/config.toml
:
[target.x86_64-unknown-linux-musl]
linker="clang"
rustflags = ["-C", "linker=clang", "-C", "link-arg=--ld-path=/nix/store/fm5083fc4ylj6zyld7n1j270m8kx0q8i-mold-2.31.0/bin/mold", "-C", "target-feature=+crt-static", "-C", "link-arg=-v"]
But something somewhere is setting these flags. I tried using bash -l
to isolate env pollution which helped remove -lconv
from the lib list.
Not sure what I should do. (Currently using clang 16)
- Cargo command run by
bash -l 'cargo build -p mtomd --release --target=x86_64-unknown-linux-musl'
rustc --crate-name mtomd --edition=2021 mtomd/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=134 --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=1cacddd9d05bd727 -C extra-filename=-1cacddd9d05bd727 --out-dir /Volumes/Navi/Users/lain/Developer/projects/ground-control/target/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=clang -L dependency=/Volumes/Navi/Users/lain/Developer/projects/ground-control/target/x86_64-unknown-linux-musl/release/deps -L dependency=/Volumes/Navi/Users/lain/Developer/projects/ground-control/target/release/deps --extern prost=/Volumes/Navi/Users/lain/Developer/projects/ground-control/target/x86_64-unknown-linux-musl/release/deps/libprost-a21df6e0ccc2cdb0.rlib --extern tokio=/Volumes/Navi/Users/lain/Developer/projects/ground-control/target/x86_64-unknown-linux-musl/release/deps/libtokio-8ab7d5b4685812a6.rlib --extern tonic=/Volumes/Navi/Users/lain/Developer/projects/ground-control/target/x86_64-unknown-linux-musl/release/deps/libtonic-f906c81e78292274.rlib -C linker=clang -C link-arg=--ld-path=/nix/store/fm5083fc4ylj6zyld7n1j270m8kx0q8i-mold-2.31.0/bin/mold -C target-feature=+crt-static -C link-arg=-v -L native=/Volumes/Navi/Users/lain/Developer/projects/ground-control/target/x86_64-unknown-linux-musl/release/build/ring-4294bf8dc348ad55/out`
This outputs the following mold command: ``` "/nix/store/fm5083fc4ylj6zyld7n1j270m8kx0q8i-mold-2.31.0/bin/mold" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -static -arch x86_64 -platform_version macos 10.12.0 14.2 ...