Realm-cocoa: Crashes after building in Xcode 11.2

Created on 2 Nov 2019  路  4Comments  路  Source: realm/realm-cocoa

Goals

Don't crash

Expected Results

Don't crash

Actual Results

Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x1c0664ef4 __pthread_kill + 8
1 libsystem_pthread.dylib 0x1c0585d1c pthread_kill + 196
2 libsystem_c.dylib 0x1c0515a54 abort + 104
3 libswiftCore.dylib 0x1ce03c9e4 swift::TargetExistentialTypeMetadata::projectValue(swift::OpaqueValue const*) const + 14
4 libswiftCore.dylib 0x1ce03e574 swift_getWitnessTable + 2128
5 HashPhotos 0x100c700e0 type metadata accessor for List ()
6 HashPhotos 0x100c6bbac HLAsset.init() ()
7 HashPhotos 0x100c6bc24 @objc HLAsset.init() ()

Code Sample

When initializing realm, app crashes

final class HLAsset: Object {
  @objc dynamic var identifier: String = ""
  // other codes

  let tags = List<HLTag>() // <= this line caused a crash
}

Version of Realm and Tooling


Realm framework version: ?
3.20.0

Xcode version: ?
11.2

iOS/OSX version: ?
iOS 13

Dependency manager + version: ?
SPM

O-Community

Most helpful comment

Try disabling dead code stripping on your app鈥檚 project: DEAD_CODE_STRIPPING = NO

All 4 comments

Try disabling dead code stripping on your app鈥檚 project: DEAD_CODE_STRIPPING = NO

@ydnar Thanks! It's working.
But it was ok until Xcode 11.1 without setting DEAD_CODE_STRIPPING=NO.

Why metadata for List() is not included only when building with iOS 13.2 SDK although List is not dead code?

There鈥檚 a bug in Xcode 11.2 with how it links SPM libraries. Generic superclass symbols are dropped, leading to the crash.

https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11564

@ydnar Thanks for the explanation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carvalho-oak picture carvalho-oak  路  3Comments

i-schuetz picture i-schuetz  路  3Comments

ishidakei picture ishidakei  路  3Comments

matteodanelli picture matteodanelli  路  3Comments

yangmeyer picture yangmeyer  路  3Comments