SQLite.swift
SQLite.swift copied to clipboard
Class SQLiteXXX is implemented in both LinkServices.framework and MyApp error logs
Build Information
- SQLite.swift 0.14.1
- Xcode 14.1 (14B47b) / macOS 12.6.1 (21G217)
- Swift Package manager
Issue
Hi,
We're seeing worrisome errors from the ObjC runtime in our logs when running an app linking both SQLite.swift and the PSPDFKit framework (https://github.com/PSPDFKit/PSPDFKit-SP / https://pspdfkit.com):
Class _TtC6SQLite6Backup is implemented in both /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/LinkServices.framework/LinkServices (0x1b8c21b70) and /[redacted]/SQLiteConnectionConflict.app/SQLiteConnectionConflict (0x1005a6538). One of the two will be used. Which one is undefined.
This is reported for several classes : SQLiteBackup, SQLiteConnection, SQLiteStatement, SQLiteTableBuilder.
Full logs
objc[67969]: Class _TtC6SQLite6Backup is implemented in both /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/LinkServices.framework/LinkServices (0x1b8c21b70) and /[redacted]/SQLiteConnectionConflict.app/SQLiteConnectionConflict (0x100c26538). One of the two will be used. Which one is undefined.
objc[67969]: Class _TtC6SQLite10Connection is implemented in both /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/LinkServices.framework/LinkServices (0x1b8c218a8) and /[redacted]/SQLiteConnectionConflict.app/SQLiteConnectionConflict (0x100c26788). One of the two will be used. Which one is undefined.
objc[67969]: Class _TtC6SQLite9Statement is implemented in both /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/LinkServices.framework/LinkServices (0x1b8c21aa0) and /[redacted]/SQLiteConnectionConflict.app/SQLiteConnectionConflict (0x100c26948). One of the two will be used. Which one is undefined.
objc[67969]: Class _TtC6SQLite12TableBuilder is implemented in both /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/LinkServices.framework/LinkServices (0x1b8c21460) and /[redacted]/SQLiteConnectionConflict.app/SQLiteConnectionConflict (0x100c27ef0). One of the two will be used. Which one is undefined.
You can reproduce the issue by creating a new iOS app in Xcode, and adding both SQLite.swift and PSPDFKit to the app with SwiftPM. A sample project is attached. Run the app and the message will immediately appear in the logs.
Can you help us understand why this error is reported and how we should fix it please?
Thanks for your help!
PS: This issue has also been reported to the PSPDFKit team, I'll update here if I get some updates on the other side.
The nice support folks at PSPDFKit pointed out that the problem is not PSPDFKit in and of itself, but the fact that PSPDFKit imports (directly of indirectly) the LinkServices.framework
:
I looked at the example project, and it seems the SQLite package has naming collision with one of the private Apple frameworks (LinkServices). If you use any framework that has the transient dependency on this private framework you will get this warnings.
In your example including PSPDFKit triggered the inclusion of LinkServices, however you will experience the same if you import any Apple framework that has the same dependency, for example QuickLook.
They also updated the sample project to demonstrate the problem even without PSPDFKit included: SQLiteConnectionConflict_NoPSPDFKit.zip
(notice the import QuickLook
in the AppDelegate.swift
)
Also, I was mistaken earlier: I was (manually) demangling the symbols names wrong, and the conflicting symbols are indeed SQLite.Backup
, SQLite.Connection
, SQLite.Statement
, SQLite.TableBuilder
.
(which makes much more sense as the classes don't have a SQLite
prefix in this library)
Honestly I'm not quite sure how to fix this problem though. It seems it's a known Swift issue, and the solution for now is to use names for packages that are "clear and specific, avoiding common phrases and terms that will overlap".
Is renaming the package something you'd be open to? 😬
This is impacting us at Airbnb as well.
Can adding an alias in both packages solve the problem? You can reference types using the alias if you cannot differentiate initial symbols. We cannot rename original types as it would break their uses. It's the same kind of fix that I did here: https://github.com/Kitura/Kitura-CouchDB/pull/117
same here
This also happens when an app uses both SQLite.swift
and imports and uses the AppIntents
system framework, so it's a problem even without other third-party libraries.
Same issue here. Seems to be causing bugs for others too: https://stackoverflow.com/questions/77206338/xcode-15-ios-17-objc3422-class-ttc6sqlite-is-implemented-in-both-one-o, any updates on this issue?
same here
Same problem here. Can't seem to track any systematic fix / resolution. Any suggestions?
same here
To resolve this I just forked the repo and renamed package from SQLite to SQLiteSwift
Its a real shame, this issue has been reported multiple times including myself in Apr last year and still not resolved https://github.com/stephencelis/SQLite.swift/issues/1201 https://github.com/stephencelis/SQLite.swift/issues/1226
Still no update?
What are the consequences of having this conflict in my project? I haven't noticed any issues so far. Was I just lucky that the correct classes were randomly chosen, or isn't there a real problem associated with this conflict?
@nathanfallet I tried with the typealias
but it did not solve the issue. Have you considered prefixing all the classes and releasing a major version?