Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we please have full control over the minimum iOS version? #383

Closed
ForceBru opened this issue Mar 21, 2019 · 3 comments
Closed

Can we please have full control over the minimum iOS version? #383

ForceBru opened this issue Mar 21, 2019 · 3 comments

Comments

@ForceBru
Copy link

I was trying to see why my build of rustc for iOS was trying to pass -miphoneos-version-min=7.0 to the compiler, even though I specifically set the following flags before compilation:

CFLAGS_aarch64_apple_ios="-miphoneos-version-min=12.0" CRATE_CC_NO_DEFAULTS=1

The output of the compilation process is the following:

TARGET = Some("aarch64-apple-ios")
OPT_LEVEL = Some("2")
HOST = Some("x86_64-apple-darwin")
CXX_aarch64-apple-ios = Some("/Users/forcebru/Desktop/Test/TOOLCHAIN/bin/clang++")
CXXFLAGS_aarch64-apple-ios = Some("-fPIC -miphoneos-version-min=12.0 --target=aarch64-apple-ios -arch arm64 -miphoneos-version-min=7.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -fembed-bitcode")
DEBUG = Some("false")
Detecting iOS SDK path for iphoneos

As one can see, the -miphoneos-version-min=12.0 flag is included in CXXFLAGS_aarch64-apple-ios, but it's immediately discarded by the auto-inserted -miphoneos-version-min=7.0 flag that comes right after it.

I think it should be possible to have control over that flag because some features, like thread-local storage (which apparently requires iOS 8.0+ or __IPHONE_OS_VERSION_MIN_REQUIRED > 70100 to be true) are not available with this setting.

This setting is hard-coded here:
https://github.com/alexcrichton/cc-rs/blob/caf78d56c7101847304724cca229ad0b14eec26b/src/lib.rs#L1601

It may be better to first check if the IPHONEOS_DEPLOYMENT_TARGET environment variable is set or CFLAGS contains -miphoneos-version-min=<stuff> before switching to default behaviour.

@alexcrichton
Copy link
Member

I think these were hardcoded once and simply never changed, seems reasonable to read env vars and add a method too!

@turboladen
Copy link
Contributor

@alexcrichton when you say

and add a method too!

...what were you thinking there? Something as explicit as

// On `Tool`
pub fn ios_version_min(&self, min_version: &str) -> Result<(), Error> {
    // etc
}

?

@alexcrichton
Copy link
Member

Sounds reasonable to me yeah!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants