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

"was built for iOS 16.4" warning after updating from 1.79 to 1.80 #128419

Open
Augustyniak opened this issue Jul 31, 2024 · 8 comments · May be fixed by #133092
Open

"was built for iOS 16.4" warning after updating from 1.79 to 1.80 #128419

Augustyniak opened this issue Jul 31, 2024 · 8 comments · May be fixed by #133092
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-ios Operating system: iOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Augustyniak
Copy link

Augustyniak commented Jul 31, 2024

Seeing the following type of warning after upgrading from rust 1.79 to 1.80:

ld: warning: object file (external/Capture/Capture.xcframework/ios-arm64/Capture.framework/Capture[441](ee9320b67fe2b8d4-lse_ldadd8_acq.o)) was built for newer 'iOS' version (16.4) than being linked (15.0)
ld: warning: object file (external/Capture/Capture.xcframework/ios-arm64/Capture.framework/Capture[442](ee9320b67fe2b8d4-lse_ldadd8_rel.o)) was built for newer 'iOS' version (16.4) than being linked (15.0)
ld: warning: object file (external/Capture/Capture.xcframework/ios-arm64/Capture.framework/Capture[443](ee9320b67fe2b8d4-lse_ldadd8_acq_rel.o)) was built for newer 'iOS' version (16.4) than being linked (15.0)
ld: warning: object file (external/Capture/Capture.xcframework/ios-arm64/Capture.framework/Capture[444](ee9320b67fe2b8d4-lse_ldclr1_relax.o)) was built for newer 'iOS' version (16.4) than being linked (15.0)
ld: warning: object file (external/Capture/Capture.xcframework/ios-arm64/Capture.framework/Capture[445](ee9320b67fe2b8d4-lse_ldclr1_acq.o)) was built for newer 'iOS' version (16.4) than being linked (15.0)
ld: warning: object file (external/Capture/Capture.xcframework/ios-arm64/Capture.framework/Capture[446](ee9320b67fe2b8d4-lse_ldclr1_rel.o)) was built for newer 'iOS' version (16.4) than being linked (15.0)
THE FULL LIST OF PROBLEMATIC `.o` FILES
lse_cas1_relax.o
lse_cas1_acq.o
lse_cas1_rel.o
lse_cas1_acq_rel.o
lse_cas2_relax.o
lse_cas2_acq.o
lse_cas2_rel.o
lse_cas2_acq_rel.o
lse_cas4_relax.o
lse_cas4_acq.o
lse_cas4_rel.o
lse_cas4_acq_rel.o
lse_cas8_relax.o
lse_cas8_acq.o
lse_cas8_rel.o
lse_cas8_acq_rel.o
lse_cas16_relax.o
lse_cas16_acq.o
lse_cas16_rel.o
lse_cas16_acq_rel.o
lse_swp1_relax.o
lse_swp1_acq.o
lse_swp1_rel.o
lse_swp1_acq_rel.o
lse_swp2_relax.o
lse_swp2_acq.o
lse_swp2_rel.o
lse_swp2_acq_rel.o
lse_swp4_relax.o
lse_swp4_acq.o
lse_swp4_rel.o
lse_swp4_acq_rel.o
lse_swp8_relax.o
lse_swp8_acq.o
lse_swp8_rel.o
lse_swp8_acq_rel.o
lse_ldadd1_relax.o
lse_ldadd1_acq.o
lse_ldadd1_rel.o
lse_ldadd1_acq_rel.o
lse_ldadd2_relax.o
lse_ldadd2_acq.o
lse_ldadd2_rel.o
lse_ldadd2_acq_rel.o
lse_ldadd4_relax.o
lse_ldadd4_acq.o
lse_ldadd4_rel.o
lse_ldadd4_acq_rel.o
lse_ldadd8_relax.o
lse_ldadd8_acq.o
lse_ldadd8_rel.o
lse_ldadd8_acq_rel.o
lse_ldclr1_relax.o
lse_ldclr1_acq.o
lse_ldclr1_rel.o
lse_ldclr1_acq_rel.o
lse_ldclr2_relax.o
lse_ldclr2_acq.o
lse_ldclr2_rel.o
lse_ldclr2_acq_rel.o
lse_ldclr4_relax.o
lse_ldclr4_acq.o
lse_ldclr4_rel.o
lse_ldclr4_acq_rel.o
lse_ldclr8_relax.o
lse_ldclr8_acq.o
lse_ldclr8_rel.o
lse_ldclr8_acq_rel.o
lse_ldeor1_relax.o
lse_ldeor1_acq.o
lse_ldeor1_rel.o
lse_ldeor1_acq_rel.o
lse_ldeor2_relax.o
lse_ldeor2_acq.o
lse_ldeor2_rel.o
lse_ldeor2_acq_rel.o
lse_ldeor4_relax.o
lse_ldeor4_acq.o
lse_ldeor4_rel.o
lse_ldeor4_acq_rel.o
lse_ldeor8_relax.o
lse_ldeor8_acq.o
lse_ldeor8_rel.o
lse_ldeor8_acq_rel.o
lse_ldset1_relax.o
lse_ldset1_acq.o
lse_ldset1_rel.o
lse_ldset1_acq_rel.o
lse_ldset2_relax.o
lse_ldset2_acq.o
lse_ldset2_rel.o
lse_ldset2_acq_rel.o
lse_ldset4_relax.o
lse_ldset4_acq.o
lse_ldset4_rel.o
lse_ldset4_acq_rel.o
lse_ldset8_relax.o
lse_ldset8_acq.o
lse_ldset8_rel.o
lse_ldset8_acq_rel.o
aarch64.o
absvdi2.o
absvsi2.o
addtf3.o
addvdi3.o
addvsi3.o
clzdi2.o
clzsi2.o
cmpdi2.o
comparetf2.o
ctzdi2.o
ctzsi2.o
divdc3.o
divsc3.o
divtf3.o
extenddftf2.o
extendhfsf2.o
extendsftf2.o
fp_mode.o
fixtfdi.o
fixtfsi.o
fixtfti.o
fixunstfdi.o
fixunstfsi.o
fixunstfti.o
floatditf.o
floatsitf.o
floatunditf.o
floatunsitf.o
int_util.o
muldc3.o
mulsc3.o
multc3.o
multf3.o
mulvdi3.o
mulvsi3.o
negdf2.o
negdi2.o
negsf2.o
negvdi2.o
negvsi2.o
paritydi2.o
paritysi2.o
popcountdi2.o
popcountsi2.o
powitf2.o
subtf3.o
subvdi3.o
subvsi3.o
truncdfhf2.o
truncsfhf2.o
trunctfdf2.o
trunctfsf2.o
ucmpdi2.o
atomic_flag_clear.o
atomic_flag_clear_explicit.o
atomic_flag_test_and_set.o
atomic_flag_test_and_set_explicit.o
atomic_signal_fence.o
atomic_thread_fence.o

Code

I expected not to see an issue with files being built for iOS 16.4 and up only.

Instead, this happened: The compiler complains about the app being built for iOS 15.0 while parts of the binary appear to have been built for iOS 16.4 and up only.

Version it worked on

It most recently worked on: 1.79

Version with regression

1.80

@Augustyniak Augustyniak added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jul 31, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 31, 2024
@Augustyniak Augustyniak changed the title "was built for iOS 16.4 error" error when updating from 1.0.79 to 1.080 "was built for iOS 16.4 error" error when updating from 1.79 to 1.80 Jul 31, 2024
@Augustyniak Augustyniak changed the title "was built for iOS 16.4 error" error when updating from 1.79 to 1.80 "was built for iOS 16.4" warning when updating from 1.79 to 1.80 Jul 31, 2024
@Augustyniak Augustyniak changed the title "was built for iOS 16.4" warning when updating from 1.79 to 1.80 "was built for iOS 16.4" warning after updating from 1.79 to 1.80 Jul 31, 2024
@tgross35
Copy link
Contributor

@madsmtm do you know if something happened with our iOS versions? https://doc.rust-lang.org/nightly/rustc/platform-support/apple-ios.html still lists 10.0 as the minimum supported.

@tgross35 tgross35 added the O-ios Operating system: iOS label Jul 31, 2024
@jieyouxu jieyouxu added A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 31, 2024
@Reflejo
Copy link

Reflejo commented Aug 1, 2024

To add more information, the problem is that the minos found in the LC_BUILD_VERSION section of some of the libs in rust-std starting on the nightly built of May 08 (this tarball) is set to 16.4. See:

$ wget https://static.rust-lang.org/dist/2024-05-08/rust-std-nightly-aarch64-apple-ios.tar.xz && tar xzvf rust-std-nightly-aarch64-apple-ios.tar.xz
$ otool -lv rust-std-nightly-aarch64-apple-ios/rust-std-aarch64-apple-ios/lib/rustlib/aarch64-apple-ios/lib/libcompiler_builtins-2a62d0fbf20b6004.rlib | grep -A3 LC_BUILD_VERSION
      cmd LC_BUILD_VERSION
  cmdsize 24
 platform IOS
    minos 10.0
--
      cmd LC_BUILD_VERSION
  cmdsize 24
 platform IOS
    minos 16.4
--
(...)

It's worth noting that LC_VERSION_MIN_IPHONEOS has been wrong for a while, but since newer toolchains only look at LC_BUILD_VERSION this wasn't a problem.

Before May 8th the compile units didn't have LC_BUILD_VERSION at all but after that build, all of them have the incorrect one.

@tgross35
Copy link
Contributor

tgross35 commented Aug 2, 2024

Looks like there were a handful of changes to https://github.com/rust-lang/rust/blob/fd8d6fbe505ecf913f5e2ca590c69a7da2789879/compiler/rustc_target/src/spec/base/apple/mod.rs about 4 months ago. #121296 seems like it could have been a candidate. @shepmaster any ideas here?

@Reflejo
Copy link

Reflejo commented Aug 4, 2024

I'm going to cross post from here, just to keep everyone up to date:

Narrowed down the problem. The problem is that after this change cc-rs stopped looking at rustc deployment target (e.g. rustc --target aarch64-apple-ios-sim --print deployment-target) in favor of just defaulting to the hosts' platform version (e.g. xcrun --show-sdk-platform-version --sdk iphonesimulator) when IPHONEOS_DEPLOYMENT_TARGET is not set.

So even if the rest of rust is doing the right thing defaulting to 10.0, when std includes compiler-builtins with the c feature, the units in the compiled libcompiler-rt.a archive have minos equal to your host tooling and when included, the whole library now is assumed to have that min deploy target.

I can think on two options here:

  1. Set IPHONEOS_DEPLOYMENT_TARGET in the ci job that builds the assets to 14.0 (this is the minimum cc-rs would take).
    or
  2. Bump rustc min targets to something more realistic and get cc-rs back to check those numbers.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 24, 2024
@apiraino
Copy link
Contributor

apiraino commented Oct 9, 2024

@rustbot label -I-prioritize -regression-untriaged

@rustbot rustbot removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-untriaged Untriaged performance or correctness regression. labels Oct 9, 2024
@kitanic
Copy link

kitanic commented Nov 12, 2024

I encountered the same problem too.
rust 1.82 doesn't seem to have fixed it yet, what is the status of this issue ?

@apiraino
Copy link
Contributor

#129432 should also tackle this issue (see opening comment)

@madsmtm madsmtm linked a pull request Nov 16, 2024 that will close this issue
@madsmtm
Copy link
Contributor

madsmtm commented Nov 16, 2024

Sorry for the long delay here, I wanted to fix this in cc proper, but that keeps taking longer than expected.

Have opened #133092 to fix it in bootstrap instead for now.

Zalathar added a commit to Zalathar/rust that referenced this issue Nov 29, 2024
…t, r=Mark-Simulacrum

Always set the deployment target when building std

`cc` has [a bug/feature](rust-lang/cc-rs#1171) (I guess depending on how you look at it) where the default deployment target is taken from the SDK instead of from `rustc`. This causes `compiler-builtins` to build `compiler-rt` with the wrong deployment target on iOS.

I've been meaning to change how `cc` works in this regard, but that's a lengthy process, so let's fix it in bootstrap for now.

The behaviour be seen locally with `./x build library --set build.optimized-compiler-builtins=true` for various target triples, and then inspecting with `otool -l build/host/stage1/lib/rustlib/*/lib/libcompiler_builtins-*.rlib | rg 'minos|version'`. I have added a rmake test that ensures that we now have the same version everywhere.

Fixes rust-lang#128419
Fixes rust-lang/compiler-builtins#650
See also rust-lang/cargo#13115

`@rustbot` label O-apple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-ios Operating system: iOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants