Skip to content

Commit fb92b70

Browse files
Rollup merge of #77716 - francesca64:revert-ios-dynamic-linking, r=jonas-schievink
Revert "Allow dynamic linking for iOS/tvOS targets." This reverts PR #73516. On macOS I compile static libs for iOS, automated using [cargo-mobile](https://github.com/BrainiumLLC/cargo-mobile), which has worked smoothly for the past 2 years. However, upon updating to Rust 1.46.0, I was no longer able to use Rust on iOS. I've bisected this to the PR referenced above. For most projects tested, apps now immediately crash with a message like this: ``` dyld: Library not loaded: /Users/francesca/Projects/example/target/aarch64-apple-ios/debug/deps/libexample.dylib Referenced from: /private/var/containers/Bundle/Application/745912AF-A928-465C-B340-872BD1C9F368/example.app/example Reason: image not found dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib ``` This can be reproduced by using cargo-mobile to generate a winit example project, and then attempting to run it on an iOS device (`cargo mobile init && cargo apple open`). In our projects that depend on DisplayLink, the build instead fails with a linker error: ``` = note: Undefined symbols for architecture arm64: "_CACurrentMediaTime", referenced from: display_link::ios::run_callback_ios10::hda81197ff46aedbd in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o) display_link::ios::run_callback_pre_ios10::h91f085da19374320 in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o) ld: symbol(s) not found for architecture arm64 ``` After reverting the change to enable dynamic linking on iOS, everything works the same as it did on Rust 1.45.2 for me. In the future, would it be possible for me to be pinged when iOS-related PRs are made? I work for a company that intends on using Rust on iOS in production, so I'd gladly provide testing. cc @aspenluxxxy
2 parents d7c635b + 16e10bf commit fb92b70

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_target/src/spec/apple_sdk_base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fn link_env_remove(arch: Arch) -> Vec<String> {
3434
pub fn opts(arch: Arch) -> TargetOptions {
3535
TargetOptions {
3636
cpu: target_cpu(arch),
37+
dynamic_linking: false,
3738
executables: true,
3839
link_env_remove: link_env_remove(arch),
3940
has_elf_tls: false,

0 commit comments

Comments
 (0)