Skip to content

not possible to specify ios/macos versions requirements when cross-compiling for ios #53808

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

Closed
mtak- opened this issue Aug 30, 2018 · 5 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-ios Operating system: iOS O-macos Operating system: macOS

Comments

@mtak-
Copy link
Contributor

mtak- commented Aug 30, 2018

I want some way to pass these arguments through cargo while doing a cross compile to iOS:

  • miphoneos-version-min
  • mios-simulator-version-min
  • mmacos-version-min

I don't see a way to do accomplish this without breaking either the build.rs scripts or the actual cross-compiled code.

Setting the environment variable MACOSX_DEPLOYMENT_TARGET will set mmacos-version-min for the build.rs scripts (yay) and the cross compiled code (boo - fails to build). The story is the reverse with IPHONEOS_DEPLOYMENT_TARGET - breaks build scripts, and works for the cross-compiled code.

Certain libraries like metal-rs have min iOS version requirements greater than iOS 7.0 which appears to be the default, so it'd be pretty handy if there was a way to tweak these flags.

I'm thinking there might be a way using RUSTC_WRAPPER or some sort of .cargo/config, but I haven't fully investigated it yet.

#29664 seems a little related.

@jonas-schievink jonas-schievink added O-macos Operating system: macOS O-ios Operating system: iOS C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jan 27, 2019
@ForceBru
Copy link

So, is there a way to pass these arguments yet? I tried setting IPHONEOS_DEPLOYMENT_TARGET="12.0", but still got the following while building rustc:

CXXFLAGS_aarch64-apple-ios = Some("-fPIC --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")

When I set CFLAGS="-miphoneos-version-min=12.0", this variable changes:

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")

But there's still the option -miphoneos-version-min=7.0, which comes after the one that's set to 12.0, so the latter is overridden...

@ovasquez
Copy link

ovasquez commented May 24, 2023

Any updates about this issue? I'm using the env variable IPHONEOS_DEPLOYMENT_TARGET and it's not using it to specify the minimum version.

@seungillee
Copy link

I'm also curious about this issue. Is there any way to specify minimum ios deployment target version?

@keith
Copy link
Contributor

keith commented Oct 24, 2023

theoretically IPHONEOS_DEPLOYMENT_TARGET should control this, any idea where the version is coming from? I believe this is where it's supposed to be handled

fn ios_deployment_target() -> (u32, u32) {
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
}
and with a quick test I see it working:

% cargo build --target aarch64-apple-ios-sim
% otool -lv target/aarch64-apple-ios-sim/debug/lolrust | grep -A2 IOSS
 platform IOSSIMULATOR
    minos 17.0
      sdk 17.0
% IPHONEOS_DEPLOYMENT_TARGET=14.0 cargo build --target aarch64-apple-ios-sim
% otool -lv target/aarch64-apple-ios-sim/debug/lolrust | grep -A2 IOSS
 platform IOSSIMULATOR
    minos 14.0
      sdk 17.0

@madsmtm
Copy link
Contributor

madsmtm commented Apr 18, 2024

Triage: I believe the original issue was about setting both MACOSX_DEPLOYMENT_TARGET and IPHONEOS_DEPLOYMENT_TARGET, this was fixed in #64254, so this issue can be closed.

Concretely, the following now works for running build scripts locally with a deployment target of macOS 11, and building the binary with a deployment target of iOS 14:

MACOSX_DEPLOYMENT_TARGET=11.0 IPHONEOS_DEPLOYMENT_TARGET=14.0 cargo build --target aarch64-apple-ios-sim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-ios Operating system: iOS O-macos Operating system: macOS
Projects
None yet
Development

No branches or pull requests

8 participants