realm / realm-swift

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

[Xcode 15] Issue to build documentation #8365

Closed MarinB69 closed 7 months ago

MarinB69 commented 1 year ago

How frequently does the bug occur?

Always

Description

Hello,

I'm currently working on a project using Swift Package Manager to obtain different packages, including Realm-Swift (currently 10.42.2). The project can build and archive correctly. I'm trying to add some documentations but when I try to build the documentation with Xcode 15 I get this kind of error:

SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So26RLMFindOneAndModifyOptionsC10RealmSwiftE10projection4sort6upsert23shouldReturnNewDocumentABSDySSAC7AnyBSONOSgGSg_ALS2btcfc' has no reference. A symbol will always have at least one reference. SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:e:s:So26RLMFindOneAndModifyOptionsC10RealmSwiftE10projectionSDySSAC7AnyBSONOSgGSgvp' has no reference. A symbol will always have at least one reference. SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 'c:@CM@RealmSwift@@objc(cs)RealmSwiftEmbeddedObject(cm)ignoredProperties' has no reference. A symbol will always have at least one reference. Command CompileDocumentation failed with a nonzero exit code

At first I thought it was my project that had a bad configuration because it has many local packages also using Realm-Swift.

But we get this error just by creating an empty project:

Are you experiencing this problem? If yes, do you know how to fix this problem?

Thanks in advance

Stacktrace & log output

SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So26RLMFindOneAndModifyOptionsC10RealmSwiftE10projection4sort6upsert23shouldReturnNewDocumentABSDySSAC7AnyBSONOSgGSg_ALS2btcfc' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:e:s:So26RLMFindOneAndModifyOptionsC10RealmSwiftE10projectionSDySSAC7AnyBSONOSgGSgvp' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 'c:@CM@RealmSwift@@objc(cs)RealmSwiftEmbeddedObject(cm)ignoredProperties' has no reference. A symbol will always have at least one reference.
Command CompileDocumentation failed with a nonzero exit code

Can you reproduce the bug?

Always

Reproduction Steps

Version

10.42.2

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 16~17

Build environment

Xcode version: 15 Dependency manager and version: Swift package manager

JuliusHuizing commented 12 months ago

Same problem here.

tisgammax commented 11 months ago

Same problem here!

JuliusHuizing commented 11 months ago

Unfortunately, problem seems to persist, also in new release RealmSwift release 10.43.0. As of now, it looks like it is impossible to use Realm in combination with Xcode 15 if you want to build documentation for your projects?

marcinax commented 11 months ago

The same here.

CompileDocumentation (in target 'RealmSwift' from project 'Realm')
    cd /Users/vagrant/deploy/build/docs_build/SourcePackages/checkouts/realm-swift
    /Applications/Xcode-15.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/docc convert --index --fallback-display-name RealmSwift --fallback-bundle-identifier RealmSwift --fallback-bundle-version 0 --output-dir /Users/vagrant/deploy/build/docs_build/Build/Products/Debug-iphoneos/RealmSwift.doccarchive --ide-console-output --diagnostics-file /Users/vagrant/deploy/build/docs_build/Build/Intermediates.noindex/Realm.build/Debug-iphoneos/RealmSwift.build/RealmSwift-diagnostics.json --additional-symbol-graph-dir /Users/vagrant/deploy/build/docs_build/Build/Intermediates.noindex/Realm.build/Debug-iphoneos/RealmSwift.build/symbol-graph
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So7RLMUserC10RealmSwiftE11mongoClientySo08RLMMongoE0CSSF' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:e:s:So24RLMCompensatingWriteInfoC10RealmSwiftE10primaryKeyAC03AnyD5ValueOvp' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So20RLMEmailPasswordAuthC10RealmSwiftE11confirmUser_7tokenId7Combine6FutureCyyts5Error_pGSS_SStF' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So16RealmSwiftObjectC0aB0E7observe8keyPaths2on_So20RLMNotificationTokenCSaySSGSg_So17OS_dispatch_queueCSgyAC0C6ChangeOyxGctSo13RLMObjectBaseCRbzlF' has no reference. A symbol will always have at least one reference.
Command CompileDocumentation failed with a nonzero exit code
Cheezzhead commented 11 months ago

Has anybody found any workarounds for this? Or does anybody know which previous xcode/realm version doesn't have this issue?

amaurydavid commented 11 months ago

I have the same issue with Realm 10.43.0, Cocoapods 1.13 and Xcode 15:

SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So20RLMEmailPasswordAuthC10RealmSwiftE09callResetB8Function5email8password4args7Combine6FutureCyyts5Error_pGSS_SSSayAC7AnyBSONOGtF' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So7RLMUserC10RealmSwiftE9functionsAC9FunctionsVvp' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:STsE3mapySayqd__Gqd__7ElementQzKXEKlF::SYNTHESIZED::c:objc(cs)RLMResults' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So20RLMEmailPasswordAuthC10RealmSwiftE23resendConfirmationEmail5email7Combine6FutureCyyts5Error_pGSS_tF' has no reference. A symbol will always have at least one reference.
Sangsom commented 11 months ago

Same here, tested on empty project as well and as soon as Realm is added to project, documention can't be built anymore. Realm 10.43.0, Xcode 15.0

** BUILD DOCUMENTATION FAILED **

The following build commands failed:
    CompileDocumentation (in target 'RealmSwift' from project 'Realm')
(1 failure)
JuliusHuizing commented 11 months ago

Has anybody found any workarounds for this? Or does anybody know which previous xcode/realm version doesn't have this issue?

Unfortunately not. Moving back to Xcode 14 seems to work if that's an option for you. But that's of course far from ideal in any situation.

MarinB69 commented 10 months ago

Issue still present with 10.44.0 ...

AdamDia commented 10 months ago

Same here with 10.44.0

pinalpsspl commented 9 months ago

Same issue with 10.44.0

CompileDocumentation (in target 'RealmSwift' from project 'Realm') cd /Users/UserName/Library/Developer/Xcode/DerivedData/ProjectName-cmhnsjuckdubbtaubfagmkcawuak/SourcePackages/checkouts/realm-swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/docc convert --index --fallback-display-name RealmSwift --fallback-bundle-identifier RealmSwift --fallback-bundle-version 0 --output-dir /Users/UserName/Library/Developer/Xcode/DerivedData/ProjectName-cmhnsjuckdubbtaubfagmkcawuak/Build/Products/Debug-iphoneos/RealmSwift.doccarchive --ide-console-output --diagnostics-file /Users/UserName/Library/Developer/Xcode/DerivedData/ProjectName-cmhnsjuckdubbtaubfagmkcawuak/Build/Intermediates.noindex/Realm.build/Debug-iphoneos/RealmSwift.build/RealmSwift-diagnostics.json --additional-symbol-graph-dir /Users/UserName/Library/Developer/Xcode/DerivedData/ProjectName-cmhnsjuckdubbtaubfagmkcawuak/Build/Intermediates.noindex/Realm.build/Debug-iphoneos/RealmSwift.build/symbol-graph

SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So18RLMMongoCollectionC10RealmSwiftE12changeEvents6onOpen7Combine22AsyncThrowingPublisherVyAF10PublishersOACE05WatchL0VGyyYbc_tF' has no reference. A symbol will always have at least one reference. SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So26RealmSwiftAsymmetricObjectC0aB0E12objectSchemaAC0dF0Vvp' has no reference. A symbol will always have at least one reference. Command CompileDocumentation failed with a nonzero exit code

JuliusHuizing commented 9 months ago

So this is starting to become increasingly problematic in my opinion. Seems like anyone using Xcode 15 together with RealmSwift has not been able to build documentation now for > 2 months? Or are we some unlucky subset of users?

Hope this issue gets picked up soon by someone from the Realm-swift team...! Cheers in advance.

vcalfa commented 9 months ago

@Cheezzhead @JuliusHuizing try to set DOCC_EXTRACT_EXTENSION_SYMBOLS = NO for the targets Realm and RealmSwift in the "Documentation Compiler - Option" within the Build Settings tab. Hopefully, this adjustment will fix the issue for you as well.

JuliusHuizing commented 9 months ago

@Cheezzhead @JuliusHuizing try to set DOCC_EXTRACT_EXTENSION_SYMBOLS = NO for the targets Realm and RealmSwift in the "Documentation Compiler - Option" within the Build Settings tab. Hopefully, this adjustment will fix the issue for you as well.

@vcalfa Thanks for the suggestion! Can you specify how to do that exactly? I have managed to disable it for my project that uses Realm as a dependency, but I don't yet see how I can change it for The Realm packages themselves. As far as I understand, you cannot change that for packages (as explicitly stated here: https://developer.apple.com/documentation/xcode/documenting-apps-frameworks-and-packages)?

Disabling it for my project that does not seem to fix the issue unfortunately.

Tabonx commented 9 months ago

10.45.0 still the same issue. Did anyone find a workaround? Setting _DOCC_EXTRACT_EXTENSIONSYMBOLS = NO didn't work for me.

SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 'c:@CM@RealmSwift@@objc(cs)RealmSwiftEmbeddedObject(py)invalidated' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So18RLMMongoCollectionC10RealmSwiftE9insertOneyySDySSAC7AnyBSONOSgG_ys6ResultOyAFs5Error_pGctF' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So24RealmSwiftEmbeddedObjectC0aB0E11dynamicListyAC0F0CyAC07DynamicD0CGSSF' has no reference. A symbol will always have at least one reference.
JuliusHuizing commented 9 months ago

10.45.0 still the same issue. Did anyone find a workaround? Setting _DOCC_EXTRACT_EXTENSIONSYMBOLS = NO didn't work for me.

SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 'c:@CM@RealmSwift@@objc(cs)RealmSwiftEmbeddedObject(py)invalidated' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So18RLMMongoCollectionC10RealmSwiftE9insertOneyySDySSAC7AnyBSONOSgG_ys6ResultOyAFs5Error_pGctF' has no reference. A symbol will always have at least one reference.
SwiftDocC/DocumentationContext.swift:1206: Fatal error: Symbol with identifier 's:So24RealmSwiftEmbeddedObjectC0aB0E11dynamicListyAC0F0CyAC07DynamicD0CGSSF' has no reference. A symbol will always have at least one reference.

Unfortunately not, still waiting for a fix.

vcalfa commented 9 months ago

@vcalfa Thanks for the suggestion! Can you specify how to do that exactly? I have managed to disable it for my project that uses Realm as a dependency, but I don't yet see how I can change it for The Realm packages themselves. As far as I understand, you cannot change that for packages (as explicitly stated here: https://developer.apple.com/documentation/xcode/documenting-apps-frameworks-and-packages)?

Disabling it for my project that does not seem to fix the issue unfortunately.

In my setup, I've integrated Realm into my project using CocoaPods, where I can change the build settings for the targets in the Pods project. However, when I was attempting to integrate the Realm with SPM, I wasn't able to find a suitable workaround. It appears that this issue might be related to the documentation compiler https://github.com/apple/swift-docc/pull/715.

sanzaru commented 8 months ago

Same here. This issue is very annoying. We can't build the documentation for any app with realm. Would be really nice if someone would prioritize the issue.

nacho4d commented 7 months ago

It appears that this issue might be related to the documentation compiler https://github.com/apple/swift-docc/pull/715.

@vcalfa Thank you for the info!.

That bug was fixed merged into Swift5.10 (https://github.com/apple/swift-docc/pull/725) which is shipped in Xcode15.3. As of today Xcode15.3 is still in beta1 so we need to wait a bit more for the official release but I was able to build the documentation of my entire app which uses realm with SPM.

nirinchev commented 7 months ago

Apologies for the delayed response here - as this should now be fixed upstream, I'll close this issue.

kakhaberikiknadze commented 6 months ago

Apologies for the delayed response here - as this should now be fixed upstream, I'll close this issue.

I have the same exact issue right now Realm 10.47.0

nirinchev commented 6 months ago

Did you upgrade to Xcode 15.3?

kakhaberikiknadze commented 6 months ago

Did you upgrade to Xcode 15.3?

Haven't yet. I see there's 15.3 RC and will download when I get a chance. Currently on 15.2 version. Have you tried it on 15.3 RC and did it work?