Closed brongan closed 2 months ago
+1
I can reproduce this on my Linux host. I'm investigating now.
The parameter appears to be added here: https://github.com/rust-lang/cc-rs/blob/994dc909dc54caa9eaa473b9807c171e1763d27e/src/lib.rs#L2659
...
match arch {
AppleArchSpec::Device(_) if is_mac => {
cmd.args
.push(format!("-mmacosx-version-min={}", min_version).into());
}
...
It seems related to this issue: https://github.com/rust-lang/cc-rs/issues/1030
Another related issue: https://github.com/rust-lang/cc-rs/issues/710
I'm not certain cross-compiling C/C++ code to MacOS from Linux via cc-rs
is expect to work like this. I tried this same method and reproduced the failure with ring and openssl; they both generate errors about these same flags:
cargo:warning=cc: error: unrecognized debug output level ‘full’
cargo:warning=cc: error: unrecognized command-line option ‘-arch’
cargo:warning=cc: error: unrecognized command-line option ‘-mmacosx-version-min=10.7’
From https://rust-lang.github.io/rustup/cross-compilation.html
Note that rustup target add only installs the Rust standard library for a given target. There are typically other tools necessary to cross-compile, particularly a linker. For example, to cross compile to Android the Android NDK must be installed. In the future, rustup will provide assistance installing the NDK components as well. See the target section of the cargo configuration for how to setup a linker to use for a certain target.
Since cross-compiling from Linux to Mac is not something we currently plan to support. I'm closing this issue. Feel free to open another issue as a feature request if you'd like us to further investigate this as a cross-compilation option.
Problem:
On an x86_64 Linux box
Fails with unknown flag errors.
Relevant details
aws-lc-rs 17
Linux 6.8.6-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 13 Apr 2024 14:44:53 +0000 x86_64 unknown
nightly-x86_64-unknown-linux-gnu (default) rustc 1.78.0-nightly (a4472498d 2024-02-15)