rust-lang / cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library
https://docs.rs/cc
Apache License 2.0
1.79k stars 434 forks source link

Don't specify `-arch` and `-m{}os-version-min=` on Apple platforms #1030

Open madsmtm opened 4 months ago

madsmtm commented 4 months ago

As recommended by Clang developers in https://github.com/llvm/llvm-project/issues/88271#issuecomment-2050425068, we already specify --target, and that should be enough.

Related: https://github.com/rust-lang/cc-rs/pull/1029, the -mxros-version-min/-mvisionos-version-min option does not exist.

CC @BlackHoleFox.

NobodyXu commented 4 months ago

sounds good to me, IIRC specifying version-min might be related to errors in other projects using cc, maybe even rustc bootstrap, which failed to compile llvm.

BlackHoleFox commented 4 months ago

Yeah ditching it seems like a fine option. Only thought is maybe compatibility with old (whatever matches 10.12) XCode versions but that might not be a real issue since there is no reason to build iOS (and derivative) apps with anything except the last N-2 XCode releases for app store reasons.

Would the idea be to remove use of -m{}os-version-min and -arch everywhere except macOS?

QuentinPerez commented 4 months ago

Maybe platform_version, it seems to support visionos.

     -platform_version platform min_version sdk_version
             This is set to indicate the platform, oldest supported version of that platform that output is to be used on, and the SDK that the output was
             built against.  platform is a numeric value as defined in <mach-o/loader.h>, or it may be one of the following strings:
             • macos
             • ios
             • tvos
             • watchos
             • bridgeos
             • visionos
             • xros
             • mac-catalyst
             • ios-simulator
             • tvos-simulator
             • watchos-simulator
             • visionos-simulator
             • xros-simulator
             • driverkit
             Specifying a newer min or SDK version enables the linker to assume features of that OS or SDK in the output file. The format of min_version
             and sdk_version is a version number such as 10.13 or 10.14