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

Crash on iOS 13 device when building with Xcode 16.1 #8723

Open
ihschan opened this issue Dec 2, 2024 · 4 comments
Open

Crash on iOS 13 device when building with Xcode 16.1 #8723

ihschan opened this issue Dec 2, 2024 · 4 comments

Comments

@ihschan
Copy link

ihschan commented Dec 2, 2024

How frequently does the bug occur?

Always

Description

When I use Xcode 16.1 with Realm version 10.54.1, to build to a real device on iOS 13.6.1,
app crashed on initializing Realm.Configration.
I can reproduce it on a clean new project as the steps provided below, so the crash reason not belongs to my project code.
And on iOS 17, iOS 18 devices, it won't crash.

Screenshot 2024-12-02 at 18 44 30 Screenshot 2024-12-02 at 18 46 21

I tried downgrade to v10.49.2 and it doesn't crashed. It seams like starting crash after v10.49.3

And I have tried the same reproduce project with same Realm version in Xcode 16.0, it doesn't crash.

Stacktrace & log output

[Stacktrace]


[Logs]
2024-12-02 18:14:52.069052+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Looking up debug dylib relative path
2024-12-02 18:14:52.069382+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Found debug dylib relative path string `RealmCrashTest.debug.dylib`
2024-12-02 18:14:52.069395+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Looking up debug dylib entry point name
2024-12-02 18:14:52.069401+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] No debug dylib entry point name defined.
2024-12-02 18:14:52.069407+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Looking up debug dylib install name
2024-12-02 18:14:52.069413+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Found debug dylib install name string `@rpath/RealmCrashTest.debug.dylib`
2024-12-02 18:14:52.069420+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Looking for Previews JIT link entry point.
2024-12-02 18:14:52.069726+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] No Previews JIT entry point found.
2024-12-02 18:14:52.069734+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Gave PreviewsInjection a chance to run and it returned, continuing with debug dylib.
2024-12-02 18:14:52.069740+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Looking for main entry point.
2024-12-02 18:14:52.069746+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Opening debug dylib with '@rpath/RealmCrashTest.debug.dylib'
2024-12-02 18:14:52.070502+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Debug dylib handle: 0x100d98230
2024-12-02 18:14:52.070518+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] No entry point found. Checking for alias.
2024-12-02 18:14:52.070527+0900 RealmCrashTest[505:38962] [PreviewsAgentExecutorLibrary] Calling provided entry point.

Can you reproduce the bug?

Always

Reproduction Steps

  1. Create a new project with Xcode 16.1
  2. Add realm package (ver. 10.54.1) with SPM
  3. Choose add RealmSwift only in the SPM window
  4. Change RealmSwift to Embed & sign
  5. In viewDidLoad function in the ViewController template file, add let realm = try? Realm(configuration: .defaultConfiguration)

Version

10.54.1

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 13.6.1

Build environment

Xcode version: ...
Dependency manager and version: ...

@Touchgram
Copy link

Touchgram commented Dec 10, 2024

see #8708 (comment)

The issue is caused by Xcode 16.1 trying to link in the Swift Concurrency back deployment library in iOS < 15. It does this by incorrectly linking to /usr/lib/swift_Concurrency.lib while it should link to @rpath/swift_Concurrency.lib.

This is suggesting it's like the problem a couple of years ago https://developer.apple.com/forums/thread/696197

Back then it was being triggered by Apple's serverside processing at the app store, I wrote about it here

Workaround from the Xcode 13.2 notes: Add -Wl,-weak-lswift_Concurrency -Wl,-rpath,/usr/lib/swift to Other Linker Flags in the app’s build settings, for that problem, does not fix the crash.

I have verified it with my iPhone7 running 14.7.1 and building with Xcode 16.2 (16C5031c)

(It was a faint hope).

@Touchgram
Copy link

I am building now with the released Xcode 16.2
Crash reproduced on iOS 14.7.1 with Realm versions;

  • 10.49.2
  • 10.48.2 (has privacy manifest)

Reverting to Xcode 16.0 and testing with Realm 10.48.2 does not crash - it was some change in Xcode 16.1 causing the problem.

Note Apple submission rules say, currently

must be built with a minimum of Xcode 15 and the iOS 17 SDK. Starting April 2025, ... must be built with the iOS 18 SDK

So we have a second workaround if necessary, although that means missing out on the new icon handling of Xcode 16

@Touchgram
Copy link

Touchgram commented Dec 13, 2024

Version 10.38.3 is the highest release that builds and runs with Xcode 16.2 on iOS14.

v10.39.1 introduced a compilation failure on older OS that wasn't fixed until 10.40.1.

The problem causing Xcode 16.1/2 to cause crashes was introduced somewhere between 10.38.3 and 10.40.1

I am unable to test my iOS 12 and 13 devices with Xcode16 due "could not locate device support files".

@ihschan
Copy link
Author

ihschan commented Dec 16, 2024

Thanks a lot for your information!

Workaround from the Xcode 13.2 notes: Add -Wl,-weak-lswift_Concurrency -Wl,-rpath,/usr/lib/swift to Other Linker Flags in the app’s build settings, for that problem, does not fix the crash.
I have tried it and same as your response, it does not fix the crash.

As updating realm version is not a must-have for us, maybe we will just keep using old version with the latest Xcode 16.2.

I am unable to test my iOS 12 and 13 devices with Xcode16 due "could not locate device support files".
btw, you can download old iOS version's device support from the repository below, then you can build to iOS 12 and iOS 13.
Instructions is on the readme.
https://github.com/filsv/iOSDeviceSupport

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

No branches or pull requests

2 participants