realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.32k stars 2.15k forks source link

Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found #8605

Closed ukushu closed 5 months ago

ukushu commented 5 months ago

How frequently does the bug occur?

Always

Description

Steps to reproduce:

Error: "Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found" error shown.

Reason shown: CoreAudioTypes is default Framework for iOS

Why you even attached AUDIO framework to Realm? Is it so necessary?

ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: Undefined symbols:
  RealmSwift.Realm.Configuration.objectTypes.setter : [__C.RLMObjectBase.Type]?, referenced from:
      FileBo.CacheService.init(env: AppCore.ServiceEnvironment) -> FileBo.CacheService in CacheService.o
  RealmSwift.Realm.Configuration.fileURL.setter : Foundation.URL?, referenced from:
      FileBo.CacheService.init(env: AppCore.ServiceEnvironment) -> FileBo.CacheService in CacheService.o
  RealmSwift.Realm.Configuration.init(fileURL: Foundation.URL?, inMemoryIdentifier: Swift.String?, syncConfiguration: RealmSwift.SyncConfiguration?, encryptionKey: Foundation.Data?, readOnly: Swift.Bool, schemaVersion: Swift.UInt64, migrationBlock: ((__C.RLMMigration, Swift.UInt64) -> ())?, deleteRealmIfMigrationNeeded: Swift.Bool, shouldCompactOnLaunch: ((Swift.Int, Swift.Int) -> Swift.Bool)?, objectTypes: [__C.RLMObjectBase.Type]?, seedFilePath: Foundation.URL?) -> RealmSwift.Realm.Configuration, referenced from:
      FileBo.CacheService.init(env: AppCore.ServiceEnvironment) -> FileBo.CacheService in CacheService.o
  type metadata accessor for RealmSwift.Realm.Configuration, referenced from:
      FileBo.CacheService.init(env: AppCore.ServiceEnvironment) -> FileBo.CacheService in CacheService.o
      outlined init with copy of RealmSwift.Realm.Configuration in CacheService.o
      outlined destroy of RealmSwift.Realm.Configuration in CacheService.o
  RealmSwift.Realm.object<A, B where A: __C.RealmSwiftObject>(ofType: A.Type, forPrimaryKey: B) -> A?, referenced from:
      (extension in FileBo):AppCore.RealmBackendService.(valueFor in _B5BF5BE0607B98AB71141586111EF994)(key: Swift.String) -> Swift.String? in CacheService.o
  RealmSwift.Realm.objects<A where A: RealmSwift.RealmFetchable>(A.Type) -> RealmSwift.Results<A>, referenced from:
      closure #1 () -> AppCore.RealmDataSource<FileBo.CacheStringEntity> in FileBo.CacheService.(data in _B5BF5BE0607B98AB71141586111EF994).getter : AppCore.RealmDataSource<FileBo.CacheStringEntity> in CacheService.o
      FileBo.CacheService.subscribeFor(key: Swift.String) -> AsyncNinja.Channel<Swift.String?, ()> in CacheService.o
  (extension in RealmSwift):RealmSwift.RealmCollection.filter(Swift.String, Any...) -> RealmSwift.Results<A.Element>, referenced from:
      FileBo.CacheService.subscribeFor(key: Swift.String) -> AsyncNinja.Channel<Swift.String?, ()> in CacheService.o
  (extension in RealmSwift):RealmSwift.RealmCollectionImpl.count.getter : Swift.Int, referenced from:
      closure #1 (RealmSwift.Results<FileBo.CacheStringEntity>, AppCore.RealmChangeset?) -> Swift.String? in FileBo.CacheService.subscribeFor(key: Swift.String) -> AsyncNinja.Channel<Swift.String?, ()> in CacheService.o
  nominal type descriptor for RealmSwift.Results, referenced from:
      _symbolic _____y_____G 10RealmSwift7ResultsV 6FileBo17CacheStringEntityC in CacheService.o
      _symbolic _____y_____G_____SgSSSg______pIegggozo_ 10RealmSwift7ResultsV 6FileBo17CacheStringEntityC 7AppCore0A9ChangesetV s5ErrorP in CacheService.o
      _symbolic _____y_____y_____G______SgtytG 10AsyncNinja7ChannelC 10RealmSwift7ResultsV 6FileBo17CacheStringEntityC 7AppCore0D9ChangesetV in CacheService.o
  protocol conformance descriptor for RealmSwift.Results<A> : RealmSwift.RealmCollection in RealmSwift, referenced from:
      lazy protocol witness table accessor for type RealmSwift.Results<FileBo.CacheStringEntity> and conformance RealmSwift.Results<A> : RealmSwift.RealmCollection in RealmSwift in CacheService.o
  protocol conformance descriptor for RealmSwift.Results<A> : RealmSwift.RealmCollectionImpl in RealmSwift, referenced from:
      lazy protocol witness table accessor for type RealmSwift.Results<FileBo.CacheStringEntity> and conformance RealmSwift.Results<A> : RealmSwift.RealmCollectionImpl in RealmSwift in CacheService.o
  RealmSwift.Results.subscript.getter : (Swift.Int) -> A, referenced from:
      closure #1 (RealmSwift.Results<FileBo.CacheStringEntity>, AppCore.RealmChangeset?) -> Swift.String? in FileBo.CacheService.subscribeFor(key: Swift.String) -> AsyncNinja.Channel<Swift.String?, ()> in CacheService.o
  protocol conformance descriptor for __C.RealmSwiftObject : RealmSwift.RealmCollectionValue in RealmSwift, referenced from:
      lazy protocol witness table accessor for type FileBo.CacheStringEntity and conformance __C.RealmSwiftObject : RealmSwift.RealmCollectionValue in RealmSwift in CacheService.o
  protocol conformance descriptor for __C.RealmSwiftObject : RealmSwift.RealmFetchable in RealmSwift, referenced from:
      lazy protocol witness table accessor for type FileBo.CacheStringEntity and conformance __C.RealmSwiftObject : RealmSwift.RealmFetchable in RealmSwift in CacheService.o
  _OBJC_CLASS_$_RealmSwiftObject, referenced from:
      full type metadata for FileBo.CacheStringEntity in CacheStringEntity.o
  _OBJC_METACLASS_$_RealmSwiftObject, referenced from:
      _OBJC_METACLASS_$__TtC6FileBo17CacheStringEntity in CacheStringEntity.o
  _RLMRealmPathForFile, referenced from:
      default argument 0 of RealmSwift.Realm.Configuration.init(fileURL: Foundation.URL?, inMemoryIdentifier: Swift.String?, syncConfiguration: RealmSwift.SyncConfiguration?, encryptionKey: Foundation.Data?, readOnly: Swift.Bool, schemaVersion: Swift.UInt64, migrationBlock: ((__C.RLMMigration, Swift.UInt64) -> ())?, deleteRealmIfMigrationNeeded: Swift.Bool, shouldCompactOnLaunch: ((Swift.Int, Swift.Int) -> Swift.Bool)?, objectTypes: [__C.RLMObjectBase.Type]?, seedFilePath: Foundation.URL?) -> RealmSwift.Realm.Configuration in CacheService.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

10.42.0

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

macOS

Build environment

Xcode version: Version 15.1 (15C65)

sync-by-unito[bot] commented 5 months ago

➤ PM Bot commented:

Jira ticket: RCOCOA-2371

Jaycyn commented 5 months ago

That's an odd error. I attempted to duplicate the issue by following the steps outlined in the question.

  • create "Library" project and add package RealmSwift
  • create app for macOS and add library from prev step to this app

We followed the Realm Installation instructions for SPM, ensuring we selected the correct package dependences when adding the Realm libraries.

Changed in version 10.49.3: Instead of adding both, only add one package.

Select either RealmSwift or Realm, then click Add Package.

If you use Swift or Swift and Objective-C APIs, add RealmSwift.

If you use only Objective-C APIs, add Realm.

Then, following the steps:

1) Create a Library project and added a package - we did this twice, one adding Realm Dependency (Objc) an one with RealmSwift Dependency

Realm_Library

2) Created a macOS app and added the library from step 1 (we tried both Swift and ObjC)

Realm_Main

We could not replicate that error in any of the cases we tried.

I am pretty sure there's nothing in Realm that references CoreAudioTypes

The error is due possibly to an import in your project, or even a podfile. My guess though it's part of or accessed via another library - for example: AsyncNinja FileBo and I seem to remember this popping up with Unity. If you're manually including the CoreAudioTypes framework - there was a known issue with XCode 15 on that one

Because CoreAudioTypes is default Framework for iOS, so you don't need import it into your project.

So any other library that has not been updated to NOT include it may be the culprit.

nirinchev commented 5 months ago

This may be caused by the automatic schema discoverability functionality that Realm has. Can you try to explicitly specify the objectTypes on the configuration you use to open the Realm with?

ukushu commented 5 months ago

At the moment no,

maybe in few days I will try to reproduce the issue with environment that I will have ability to give you :)

kelvinharron commented 5 months ago

I've seen this in our codebase and thought nothing of it, but while trying to diagnose an issue with the 10.50.1 upgrade, I get this output.

ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RLMNotificationToken", referenced from:
       in RealmListExtensions.o
  "_OBJC_CLASS_$_RLMObjectBase", referenced from:
       in Assessments.o
  "_OBJC_CLASS_$_RealmSwiftEmbeddedObject", referenced from:
      full type metadata for App.Permissions in Permission.o
      full type metadata for App.ListEntryCollection in ListEntryCollection.o
      full type metadata for App.ListEntryValue in ListEntryCollection.o
      full type metadata for App.ListEntryMedication in ListEntryCollection.o
      full type metadata for App.ListEntryState in ListEntryCollection.o
      full type metadata for App.ListEntryLocation in ListEntryCollection.o
      full type metadata for App.ListEntryMetadata in ListEntryCollection.o
      ...
  "_OBJC_CLASS_$_RealmSwiftObject", referenced from:
      full type metadata for App.PermissionsRecord in Permission.o
      full type metadata for App.PersistableSettings in PersistableSettings.o
      full type metadata for App.PersistableUser in PersistableUser.o
      full type metadata for App.PersistableConfigBundle in PersistableConfigBundle.o
      full type metadata for App.Record in Record.o
      full type metadata for App.PersistableCreateRecordResponse in Record.o
      full type metadata for App.VitalEntry in VitalEntry.o
      ...
  "_OBJC_METACLASS_$_RealmSwiftEmbeddedObject", referenced from:
      _OBJC_METACLASS_$__TtC3EHR11Permissions in Permission.o
      _OBJC_METACLASS_$__TtC3EHR19ListEntryCollection in ListEntryCollection.o
      _OBJC_METACLASS_$__TtC3EHR14ListEntryValue in ListEntryCollection.o
      _OBJC_METACLASS_$__TtC3EHR19ListEntryMedication in ListEntryCollection.o
      _OBJC_METACLASS_$__TtC3EHR14ListEntryState in ListEntryCollection.o
      _OBJC_METACLASS_$__TtC3EHR17ListEntryLocation in ListEntryCollection.o
      _OBJC_METACLASS_$__TtC3EHR17ListEntryMetadata in ListEntryCollection.o
      ...
  "_OBJC_METACLASS_$_RealmSwiftObject", referenced from:
      _OBJC_METACLASS_$__TtC3EHR17PermissionsRecord in Permission.o
      _OBJC_METACLASS_$__TtC3EHR19PersistableSettings in PersistableSettings.o
      _OBJC_METACLASS_$__TtC3EHR15PersistableUser in PersistableUser.o
      _OBJC_METACLASS_$__TtC3EHR23PersistableConfigBundle in PersistableConfigBundle.o
      _OBJC_METACLASS_$__TtC3EHR6Record in Record.o
      _OBJC_METACLASS_$__TtC3EHR31PersistableCreateRecordResponse in Record.o
      _OBJC_METACLASS_$__TtC3EHR10VitalEntry in VitalEntry.o
      ...
  "_RLMRealmPathForFile", referenced from:
      default argument 0 of RealmSwift.Realm.Configuration.init(fileURL: Foundation.URL?, inMemoryIdentifier: Swift.String?, syncConfiguration: RealmSwift.SyncConfiguration?, encryptionKey: Foundation.Data?, readOnly: Swift.Bool, schemaVersion: Swift.UInt64, migrationBlock: ((__C.RLMMigration, Swift.UInt64) -> ())?, deleteRealmIfMigrationNeeded: Swift.Bool, shouldCompactOnLaunch: ((Swift.Int, Swift.Int) -> Swift.Bool)?, objectTypes: [__C.RLMObjectBase.Type]?, seedFilePath: Foundation.URL?) -> RealmSwift.Realm.Configuration in RealmProvider.o
ld: symbol(s) not found for architecture arm64

I can't get a sample project together easily at the moment to help with this, but I expect our project setup is to blame for why adopting anything new since Realm enabled dynamic frameworks.

nirinchev commented 5 months ago

Ah wait, that CoreAudioTypes seems to be a red herring - that's just a warning that appears above the actual error. Are you both of you using SPM to import Realm? Also, @ukushu's error seems to happen on 10.42, which was before we switched to dynamic linking, while @kelvinharron reports this happens with 10.50.1.

kelvinharron commented 5 months ago

That's right @nirinchev , SPM based with Tuist building a project for us. I did see it previously on 10.47.0. Sounds like an issue we can ignore then? as its the timing of when the error is output as part of linking the app target makes it seem realm related.

nirinchev commented 5 months ago

So the core audio thing seems to be a warning and could be ignored, but the rest of the logs seem to point to a legitimate error. From what I've seen on the internet, those are configuration issues, but there's no obvious common cause and different reports have had different resolutions. I'd recommend either trying to reproduce it so we can take a look or trying to see if any of the solutions reported on SO/other github projects are applicable for you.

github-actions[bot] commented 5 months ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

sbo-nemlig commented 4 months ago

@ukushu did you finde a workaround we have the same issue with Tuist ? For us it stopped to work after 10.46.0 release

makstikhonov commented 4 months ago

@ukushu did you finde a workaround we have the same issue with Tuist ? For us it stopped to work after 10.46.0 release

I am also using Tuist and the problem was solved by connecting realm as .staticFramework

sakshibala-halodoc commented 3 months ago

I am using Tuist V4. Realm 10.45.2 works fine for me. V10.52.2 is throwing the same error for me.

ImaginativeShohag commented 2 months ago

For Tuist users: I am using Tuist 4.24.0 and Realm version 10.52.3.

I added both RealmSwift and Realm as dependency and use product type .framework, then the error is gone for me.