rui314 / mold

Mold: A Modern Linker šŸ¦ 
MIT License
13.69k stars 448 forks source link

mold: fatal: unknown command line option: -arch #1259

Open therealjasonkenney opened 1 month ago

therealjasonkenney commented 1 month ago

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)

rui314 commented 1 month ago

-demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -static -arch x86_64 -platform_version macos 10.12.0 14.2 ...

Those flags are for the macOS linker and not compatible with Linux linkers. It looks like you are trying to cross compile your program for macOS instead of for x86_64-unknown-linux-musl.