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

[Xcode 15] iOS 14.5 crashing with Realm 10.42.3 #8369

Closed
andlang opened this issue Sep 19, 2023 · 27 comments
Closed

[Xcode 15] iOS 14.5 crashing with Realm 10.42.3 #8369

andlang opened this issue Sep 19, 2023 · 27 comments

Comments

@andlang
Copy link

andlang commented Sep 19, 2023

How frequently does the bug occur?

Always

Description

After building the app with Xcode 15 and Realm 10.42.3 (using SPM), it crashes immediately while starting it in the simulator with Thread 1: EXC_BAD_ACCESS (code=1, address=0x0).

Xcode shows the following for this thread:

When building and running the app with Xcode 14.3.1 (14E300c) and also Realm 10.42.3, there isn’t any crash.

Stacktrace & log output

Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [49668]

Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   ???                           	               0x0 ???
1   App                            	       0x104f29f1c _GLOBAL__sub_I_RLMApp.mm + 28
2   dyld_sim                      	       0x10e641f54 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 424
3   dyld_sim                      	       0x10e64231c ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 52
4   dyld_sim                      	       0x10e63ca40 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 448
5   dyld_sim                      	       0x10e63ac78 ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 184
6   dyld_sim                      	       0x10e63ad40 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 92
7   dyld_sim                      	       0x10e62e33c dyld::initializeMainExecutable() + 216
8   dyld_sim                      	       0x10e632d88 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4440
9   dyld                          	       0x10e887d88 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1328
10  dyld                          	       0x10e88664c dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 276
11  dyld                          	       0x10e885e18 start + 1964

Thread 1:
0   libsystem_pthread.dylib       	       0x1bca3f634 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	       0x1bca3f634 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib       	       0x1bca3f634 start_wqthread + 0

Can you reproduce the bug?

Always

Reproduction Steps

It crashes always during app start.

Version

10.42.3

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 14.5

Build environment

Xcode version: 15.0 (15A240d)
Dependency manager and version: SPM

@andlang
Copy link
Author

andlang commented Sep 19, 2023

This bug is similar like #8343.

@michalnowak061
Copy link

bump

@Oreliano
Copy link

Same issue here.

I've created a new project and just added Realm with SPM. It crashes on iOS 12 (device) and iOS 14 (simulator).

Could it be related to this known issue with Xcode 15 new Linker ? (I tried the workaround but no luck)

@iamanthonyzhu
Copy link

any solution for this?

@vuongxuantuyen
Copy link

@Oreliano is it crash on iOS 14 device?

@Oreliano
Copy link

@Oreliano is it crash on iOS 14 device?

I don't know, I don't have a device running iOS 14

@alexkok
Copy link

alexkok commented Sep 22, 2023

Also having the crashes on Realm initialization since xCode 15.
Used Realm 10.38.0, but updating to 10.42.3 didn't resolve it -- using Cocoapods.

Crashes on initialization on both iOS 12 and iOS 14 (physical devices)

@GordonLJY
Copy link

GordonLJY commented Sep 22, 2023

Same issue here.

I've created a new project and just added Realm with SPM. It crashes on iOS 12 (device) and iOS 14 (simulator).

Could it be related to this known issue with Xcode 15 new Linker ? (I tried the workaround but no luck)

I managed to resolve this issue after implementing the workaround method (Adding the -Wl,-ld_classic options to the OTHER_LDFLAGS build in the project settings). Tried initialising basic Realm project on iOS 14.5 simulator.

If you are using RealmSwift via Cocoapods, -Wl,-ld_classic options must also be added to the OTHER_LDFLAGS in the Pods's project setting as well.

@michalnowak061
Copy link

michalnowak061 commented Sep 24, 2023

I have this problem on physical devices (real users). Any official solution? No workaround
@tgoyne

@tgoyne
Copy link
Member

tgoyne commented Sep 24, 2023

As noted above you need to pass -Wl,-ld_classic because the new linker does not support iOS <15.

@iamanthonyzhu
Copy link

iamanthonyzhu commented Sep 25, 2023

as above, -Wl, -ld_classic works

@Oreliano
Copy link

As noted above you need to pass -Wl,-ld_classic because the new linker does not support iOS <15.

Unfortunately the workaround only works for iOS 13 and 14.

@Subloran
Copy link

We have reports of this issue from users with iOS 12.5.

@lcl2539
Copy link

lcl2539 commented Sep 26, 2023

We have reports of this issue from users with iOS 12.5.

Same on 12.5.6

@tgoyne
Copy link
Member

tgoyne commented Sep 26, 2023

I recommend reporting that to Apple as things not working on iOS 12 is not listed in the known issues for Xcode 15. You will need to use Xcode 14 until they fix it.

@Subloran
Copy link

I recommend reporting that to Apple as things not working on iOS 12 is not listed in the known issues for Xcode 15. You will need to use Xcode 14 until they fix it.

There is no way to do it. We have a new bug with conflict of WKWebView with standard keyboard on iOS 17 if application is built by Xcode 14. There is impossible to analyse the new issue in that black boxes, so the only way is to use the latest software hoping for fast bugfixes.

@GCSNNB
Copy link

GCSNNB commented Sep 26, 2023

as above, -Wl, -ld_classic works

adding these doesn't work for me, My project can't build successful.

@michalnowak061
Copy link

as above, -Wl, -ld_classic works

adding these doesn't work for me, My project can't build successful.

same

@zcohan
Copy link

zcohan commented Sep 27, 2023

I'm facing the same issue for users running macOS Big Sur.

@Subloran
Copy link

Is the Realm team working on this issue? Should we wait for iOS 12 fix or switch to another framework?

@michalnowak061
Copy link

v10.43.0 fixed this issue for me 🚀

@Oreliano
Copy link

Oreliano commented Oct 2, 2023

Just found how to solve the issue on iOS 12.

In addition to the -Wl, -ld_classic flags, go to Build Phases > Link Binary With Libraries, add SwiftUI and set it to Optional.

Also, be careful, there is an error in Realm latest changelog (-classic_ld instead of -ld_classic)

@alexkok
Copy link

alexkok commented Oct 4, 2023

Just found how to solve the issue on iOS 12.

In addition to the -Wl, -ld_classic flags, go to Build Phases > Link Binary With Libraries, add SwiftUI and set it to Optional.

Also, be careful, there is an error in Realm latest changelog (-classic_ld instead of -ld_classic)

Yep, thanks! Works for me as well now on iOS 12, 13 and 14 👍

@AndyZZhz
Copy link

Same issue here.
I've created a new project and just added Realm with SPM. It crashes on iOS 12 (device) and iOS 14 (simulator).
Could it be related to this known issue with Xcode 15 new Linker ? (I tried the workaround but no luck)

I managed to resolve this issue after implementing the workaround method (Adding the -Wl,-ld_classic options to the OTHER_LDFLAGS build in the project settings). Tried initialising basic Realm project on iOS 14.5 simulator.

If you are using RealmSwift via Cocoapods, -Wl,-ld_classic options must also be added to the OTHER_LDFLAGS in the Pods's project setting as well.

It does not work for me, I try it on device system with 12.x、iOS13.x、 14.x , all Crash
https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking

@iamanthonyzhu
Copy link

Just found how to solve the issue on iOS 12.

In addition to the -Wl, -ld_classic flags, go to Build Phases > Link Binary With Libraries, add SwiftUI and set it to Optional.

Also, be careful, there is an error in Realm latest changelog (-classic_ld instead of -ld_classic)

Yep thanks

@tgoyne
Copy link
Member

tgoyne commented Dec 11, 2023

The release notes claim that this is fixed in Xcode 15.1, which was released today.

@ppamorim
Copy link

@tgoyne Yes it's indeed fixed. Our app was crashing on jailbroken devices and updating Xcode to the latest version sorted the issue. We need the app working on jailbroken devices for pentest reasons.

@nirinchev nirinchev closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
@sync-by-unito sync-by-unito bot closed this as completed Feb 16, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests