firebase-ios-sdk: XCode 15.0 Release - firebase-ios-sdk bug: An attribute list cannot appear here

Description

The FIRFirestoreSettings has an error after updating to XCode release version 15.0 on this line: // Public constant ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited = Settings::CacheSizeUnlimited; Error: An attribute list cannot appear here

Reproducing the issue

Try to build an existing iOS app that was previously working that used the FirebaseFirestore module. It no longer builds after the XCode update.

Firebase SDK Version

??

Xcode Version

15.0

Installation Method

Swift Package Manager

Firebase Product(s)

Firestore

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project’s Package.resolved

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project’s Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 8
  • Comments: 29 (9 by maintainers)

Most upvoted comments

@dsert1 I had the same issue. I think you may be operating on Firebase 9.6.0 SDK version.

I fixed the issue by going into my Project - Package Dependencies.

I changed the range by changing the drop down from “Update to Next Major Version” to “Range of Versions” then changing it from 9.0.0 < 10.0.0 to 10.0.0 < 11.0.0

Then changed the drop down back to ‘Update to Next Major Version’. Once that set in, the packages updated and my project ran fine.

Hope that helps.

in Xcode, go to FIRFirestoreSettings.mm file, look for(go to pods, and you will see FIRbaseFirestore folder, open it);-

ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
    Settings::CacheSizeUnlimited;

and change it to;-

extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
Settings::CacheSizeUnlimited;

run your build, this should work

@huuthanit Thanks for the Podfile hack! You can probably even simplify your sed script further by just stripping out all occurrences of ABSL_CONST_INIT, something like this:

sed -i '' 's/ABSL_CONST_INIT//g' Pods/FirebaseFirestore/Firestore/Source/API/FIRFirestoreSettings.mm

After all, ABSL_CONST_INIT doesn’t actually affect any runtime behavior, but rather ensures that the variable can be initialized at compile time with a compile-time constant. It does not affect correctness.

in Xcode, go to FIRFirestoreSettings.mm file, look for(go to pods, and you will see FIRbaseFirestore folder, open it);-

ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
    Settings::CacheSizeUnlimited;

and change it to;-

extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
Settings::CacheSizeUnlimited;

run your build, this should work

Can’t we make this process from Podfile automate.

@aslamanver This is my solution for automate.

on Podfile

post_install do |installer|
     system('sh fix-build-for-xcode15.sh')
 end

on file fix-build-for-xcode15.sh

echo "Fixing build for Xcode 15"
sed -i '' 's/ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =/extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =/g' Pods/FirebaseFirestore/Firestore/Source/API/FIRFirestoreSettings.mm

Thanks @dconeybe It seems to be fixed after removing and adding FirebaseFirestore, FirebaseFirestoreSwift again in the frameworks, libraries section in the project target. I also run pod install but I don’t have Firebase as pod (using it with SPM) but I have different Pods not related to Firebase (such as Google-Mobile-Ads-SDK).

in Xcode, go to FIRFirestoreSettings.mm file, look for(go to pods, and you will see FIRbaseFirestore folder, open it);-

ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
    Settings::CacheSizeUnlimited;

and change it to;-

extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
Settings::CacheSizeUnlimited;

run your build, this should work

Can’t we make this process from Podfile automate.

@rharshaw solution worked for me.

For anyone experiencing this issue, please attempt to reproduce in the latest version, which is 10.15.0 at the time of writing. If this is fixed in the latest version then the “fix” is to upgrade. Otherwise, we will fix it in the next version. So either way, an upgrade will be needed in order to get the fix. Thanks!

I got the same issue as well. Here is the details of my side: I’m using SPM - Firebase 9.6.0 Error Line: ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited = Settings::CacheSizeUnlimited; Error: An attribute list cannot appear here Error file path : Firebase -> Firestore -> API -> FIRFirestoreSettings / Line - 33 Running Device: Simulator 14 Pro / 16.4