Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any version 10.17.0 or higher: Error (Xcode): Undefined symbol #79

Closed
AliKales opened this issue Nov 12, 2023 · 93 comments
Closed

any version 10.17.0 or higher: Error (Xcode): Undefined symbol #79

AliKales opened this issue Nov 12, 2023 · 93 comments
Assignees

Comments

@AliKales
Copy link

After updating cloud_firestore to 4.13.0 and 10.16.0 to 10.17.0 and error start to show up. Please check below

flutter run -v

flutter_run.txt

i tried flutter clean, removing Pods, podfile.lock PodFile then pod install --repo-update

my Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.17.0'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

flutter doctor -v


[✓] Flutter (Channel stable, 3.13.6, on macOS 13.4 22F66 darwin-arm64, locale tr-TR)
    • Flutter version 3.13.6 on channel stable at /Users/kales/Documents/code/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ead455963c (7 weeks ago), 2023-09-26 18:28:17 -0700
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/kales/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.84.2)
    • VS Code at /Users/kales/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android
      13 (API 33) (emulator)
    • iPhone 14 Pro (mobile)      • 418D3F60-17D4-487D-AEB2-21D42173165D • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS
      13.4 22F66 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google
      Chrome 119.0.6045.123

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Long story short, after updating to 10.17.0 it doesnt want to work

@lukepighetti

This comment was marked as duplicate.

@AliKales

This comment was marked as duplicate.

@lukepighetti
Copy link

My solution has been to downgrade and pin

@mikehardy

This comment was marked as off-topic.

@AliKales
Copy link
Author

OK, thank you for your advises. For now it is not urgent for me to build for IOS i just wanted to let you know about the problem. I prefer to wait your solution for version 10.17.0. I'm not closing the issue for now. Thanks!

@mikehardy

This comment was marked as outdated.

@AliKales

This comment was marked as outdated.

@russellwheatley
Copy link
Member

russellwheatley commented Nov 17, 2023

Hey @mikehardy I've spent quite a while looking into this issue. Unfortunately, I have not been able to solve it. I thought I'd report my findings:

The framework ships with FirebaseSharedSwift binary. It works fine until your project pulls in another dependency that has a transitive dependency on FirebaseSharedSwift.

For instance, this works fine:

dependencies:
  cloud_firestore: ^4.13.1
  firebase_core: ^2.22.0
  flutter:
    sdk: flutter

This produces the error:

dependencies:
  cloud_firestore: ^4.13.1
  firebase_core: ^2.22.0
  firebase_database: ^10.3.4
  flutter:
    sdk: flutter

This is because firebase_database creates a transitive dependency on FirebaseSharedSwift. Snippet from Podfile.lock:

  - FirebaseDatabase (10.18.0):  
    - FirebaseAppCheckInterop (~> 10.17)  
    - FirebaseCore (~> 10.0)  
    - FirebaseSharedSwift (~> 10.0)  
    - leveldb-library (~> 1.22)

Here is the first line of the erroneous build log from Xcode:

ld: Undefined symbols:
  enum case for FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy.blob(FirebaseSharedSwift.FirebaseDataDecoder.DataDec
Full build log of exception
ld: Undefined symbols:
  enum case for FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy.blob(FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      closure #1 () throws -> A1 in closure #4 (__C.FIRQueryDocumentSnapshot) -> A1? in closure #1 (__C.FIRQuerySnapshot?, Swift.Error?) -> () in FirebaseFirestore.FirestoreQueryObservable.init<A where A == [A1], A1: Swift.Decodable>(configuration: FirebaseFirestore.FirestoreQuery<[A1]>.Configuration) -> FirebaseFirestore.FirestoreQueryObservable<[A1]> in FirebaseFirestore[19](FirestoreQueryObservable.o)
  enum case for FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy.useDefaultKeys(FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      closure #1 () throws -> A1 in closure #4 (__C.FIRQueryDocumentSnapshot) -> A1? in closure #1 (__C.FIRQuerySnapshot?, Swift.Error?) -> () in FirebaseFirestore.FirestoreQueryObservable.init<A where A == [A1], A1: Swift.Decodable>(configuration: FirebaseFirestore.FirestoreQuery<[A1]>.Configuration) -> FirebaseFirestore.FirestoreQueryObservable<[A1]> in FirebaseFirestore[19](FirestoreQueryObservable.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.keyDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  enum case for FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy.custom(FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy.Type) -> ((Swift.Decoder) throws -> Foundation.Date) -> FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      closure #1 () throws -> A1 in closure #4 (__C.FIRQueryDocumentSnapshot) -> A1? in closure #1 (__C.FIRQuerySnapshot?, Swift.Error?) -> () in FirebaseFirestore.FirestoreQueryObservable.init<A where A == [A1], A1: Swift.Decodable>(configuration: FirebaseFirestore.FirestoreQuery<[A1]>.Configuration) -> FirebaseFirestore.FirestoreQueryObservable<[A1]> in FirebaseFirestore[19](FirestoreQueryObservable.o)
      static (extension in FirebaseFirestore):FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy.timestamp.getter : FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy in FirebaseFirestore[25](TimestampDecodingStrategy.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.dataDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.dateDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.passthroughTypeResolver.setter : FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.Type, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  enum case for FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy.throw(FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Decoder in FirebaseFirestore[14](EncoderDecoder.o)
      closure #1 () throws -> A1 in closure #4 (__C.FIRQueryDocumentSnapshot) -> A1? in closure #1 (__C.FIRQuerySnapshot?, Swift.Error?) -> () in FirebaseFirestore.FirestoreQueryObservable.init<A where A == [A1], A1: Swift.Decodable>(configuration: FirebaseFirestore.FirestoreQuery<[A1]>.Configuration) -> FirebaseFirestore.FirestoreQueryObservable<[A1]> in FirebaseFirestore[19](FirestoreQueryObservable.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.nonConformingFloatDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.userInfo.setter : [Swift.CodingUserInfoKey : Any], referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Decoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A in FirebaseFirestore[14](EncoderDecoder.o)
  enum case for FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy.blob(FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
  enum case for FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy.useDefaultKeys(FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.keyEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  enum case for FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy.custom(FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy.Type) -> ((Foundation.Date, Swift.Encoder) throws -> ()) -> FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
      static (extension in FirebaseFirestore):FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy.timestamp.getter : FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy in FirebaseFirestore[26](TimestampEncodingStrategy.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.dataEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.dateEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.passthroughTypeResolver.setter : FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.Type, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  enum case for FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy.throw(FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.__allocating_init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.init() -> (extension in FirebaseFirestore):__C.FIRFirestore.Encoder in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.nonConformingFloatEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.encode<A where A: Swift.Encodable>(A) throws -> Any, referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.userInfo.setter : [Swift.CodingUserInfoKey : Any], referenced from:
      (extension in FirebaseFirestore):__C.FIRFirestore.Encoder.encode<A where A: Swift.Encodable>(A) throws -> [Swift.String : Any] in FirebaseFirestore[14](EncoderDecoder.o)
  method descriptor for static FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.isPassthroughType<A>(A1) -> Swift.Bool, referenced from:
      l_got.$s19FirebaseSharedSwift38StructureCodingPassthroughTypeResolverP02isfG0ySbqd__lFZTq in FirebaseFirestore[6](CodablePassThroughTypes.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The exception points to missing objects as opposed to missing header files.The architecture is correct (I checked the framework binary architecture by running lipo -info FirebaseSharedSwift) which produced the correct - Non-fat file: FirebaseSharedSwift is architecture: arm64.

Edits to the FirebaseFirestore.podspec that failed

  • Removed FirebaseSharedSwift framework from the distribution if using firebase_database as a dependency, and use the FirebaseSharedSwift transitive dependency. Still produced the same exception.
  • Removed FirebaseSharedSwift binary from the distribution and made it a dependency instead. Still produced the same exception.
  • Updated some of the settings to match what is set in the podspec of FirebaseFirestore on the firebase-ios-sdk. Still produced the same exception.

Really not sure how to fix this problem. Have you experienced this on RNFB? or have any thoughts on a solution? 🤔

@paulb777
Copy link

I'm not sure if this is helpful or not, but we solved a similar problem with the Swift Package Manager distribution and its binary Firestore target by wrapping Firestore in an "Internal" target and having an outer Firestore target depend on both FirestoreInternal and FirebaseSharedSwift - https://github.com/firebase/firebase-ios-sdk/blob/master/Package.swift#L1503

@russellwheatley
Copy link
Member

Thanks for the heads up, @paulb777 👍 . We had a try implementing the above and still couldn't get beyond the exception. Do you mind taking a look at these changes to see if there is something we could do to fix it?

main...test-fixing10#diff-722406d90405bff17f7e918babfa09df6eb0e10808c09f55b7349f15d1996c99R35

@paulb777
Copy link

I think that FirebaseFirestoreInternal and FirebaseSharedSwift should both be plain dependencies of the Invertase FirebaseFirestore.podspec without the special handling. cc: @ncooke3.

@ncooke3
Copy link

ncooke3 commented Nov 17, 2023

I don't have an immediate answer, but I'll add some more context to what changes happened in 10.17.0.

I'm not sure if this is helpful or not, but we solved a similar problem with the Swift Package Manager distribution and its binary Firestore target by wrapping Firestore in an "Internal" target and having an outer Firestore target depend on both FirestoreInternal and FirebaseSharedSwift - https://github.com/firebase/firebase-ios-sdk/blob/master/Package.swift#L1503

Adding on to the above comment, the outer Firestore target is a source target and so is the FirebaseSharedSwift target. So the dependency chain for Firestore's SwiftPM distribution looks like below. I'm excluding some other transitive dependencies like FirebaseCore, gRPC, etc.

- Firestore (source target composed of Swift sources):
  - FirestoreInternal (binary target)
  - SharedSwift (source target composed of Swift sources)

FirestoreInternal is composed of the sources that used to live in Firestore. And Firestore is now composed of the sources that used to live in FirestoreSwift. So FirestoreInternal is the big framework that we distributed as a binary to optimize build time.

The framework ships with FirebaseSharedSwift binary. It works fine until your project pulls in another dependency that has a transitive dependency on FirebaseSharedSwift.

This is the reason that SharedSwift remained a source target in the SwiftPM distribution. If we made it a binary target, then other top-level source targets that depend on SharedSwift (like Database) would not build since I had issues getting a source Swift module to depends on a binary Swift module. I think this is related to the problem we are seeing here.

Potential solution: Invertase's FirestoreFirestore.podspec wraps Firebase's FirestoreFirestore.podspec, but swaps out the Firebase FirestoreFirestoreInternal dependency with Invertase's. This would mirror what is done for SwiftPM in the Firebase repo.


@russellwheatley, in the issue's description, the undefined symbols were mangled:

Undefined symbol:
           _$s19FirebaseSharedSwift0A11DataDecoderC0D16DecodingStrategyO4blobyA2EmFWC

In the error logs you included, I noticed they are not:

ld: Undefined symbols:
  enum case for FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy.blob(FirebaseSharedSwift.FirebaseDataDecoder.DataDec

Was this a result of you adding the FirebaseSharedSwift.xcframework in your branch?

I think that FirebaseFirestoreInternal and FirebaseSharedSwift should both be plain dependencies of the Invertase FirebaseFirestore.podspec without the special handling. cc: @ncooke3.

+1 for FirebaseFirestoreInternal always being there. There should be no other case it already may exist in the project (like with levelDB).

@mikehardy
Copy link
Collaborator

Commenting really briefly since I was tagged and asked a question but I have little to offer in comparison to the big knowledge drop from Nick Cooke!

Have you experienced this on RNFB? or have any thoughts on a solution?

I have not experienced this on RNFB - yet - because I converted RNFB to use ccache as it speeds up compile of the entire app / all firebase items vs just firestore as this optimization does. I typically only test react-native-firebase with this repo in response to bugs like this and I hadn't had time to do so yet.

Hopefully with the info from Paul + Nick things may be rearranged here so it works again. In react-native-firebase there is just a single line I think that is currently commented out and then it uses this podspec as a dep (possibly by git branch ref) vs the Firestore normal source podspec

@josiahsrc

This comment was marked as off-topic.

@mikehardy

This comment was marked as off-topic.

@YDA93

This comment was marked as off-topic.

@josiahsrc

This comment was marked as off-topic.

@YDA93

This comment was marked as off-topic.

@josiahsrc

This comment was marked as resolved.

@YDA93

This comment was marked as resolved.

@mikehardy

This comment was marked as off-topic.

@YDA93

This comment was marked as off-topic.

@wer-mathurin

This comment was marked as off-topic.

@mikehardy

This comment was marked as off-topic.

@jkgatt

This comment was marked as resolved.

@mikehardy
Copy link
Collaborator

@jkgatt and anyone else - this will be an issue on any firebase-ios-sdk >= 10.17.0 - it is not going to self-resolve until there is some fix here - I will update the issue title.

@lukemmtt
Copy link

lukemmtt commented Jan 23, 2024

@paulb777 's approach in #88 (comment) resolves this issue for me. Thank you Paul!

@matt-hall-zory
Copy link

As I commented in the Pull Request, this also resolved the issue for me. Thank you again Paul.
Looking forward to the merge.

@russellwheatley
Copy link
Member

@paulb777 - I was able to successfully build once I created a new Flutter project 🎉 . Thanks for the work.

To everyone else paying attention to this issue, we should hopefully get this resolved in the near future. It's not quite as simple as merging Paul's PR, but we will endeavour to get this working as soon as possible . I will let you know when it is working 🙏

@ulusoyca
Copy link

I am still having the same error. What am I missing?

  cloud_firestore: ^4.14.0
  firebase_auth: ^4.16.0
  firebase_core: ^2.24.2
  firebase_crashlytics: ^3.4.9

This is my podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'


target 'Runner' do
  use_frameworks!
  pod 'FirebaseFirestore', :git => 'https://github.com/paulb777/firestore-ios-sdk-frameworks.git', :tag => '10.18.0'
end


post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
    end
  end
end
image

@lukepighetti
Copy link

lukepighetti commented Jan 28, 2024

Used to be these frameworks were available within 48 hours (iirc) of a new release. But this one has been broken for me for almost three months. Did something change upstream? It's a very painful developer experience right now.

We were able to pin to firebase_core: 2.21.0 for a few months but now it's being left behind by other dependencies like firebase_auth

@matt-hall-zory
Copy link

I saw that Paul's PR was closed without any further info? Is there any update on this?

@mikehardy
Copy link
Collaborator

@matt-hall-zory I believe this is still a very active current work area - I don't have specific info to share but at least I personally am interested in fixing it (I love ccache, yes, but I want this to work too). And I'm pretty sure Mike D and Russell and Paul B are all working on it

Usually when Mike D closes stuff it's because he just went and fixed everything, so I have my fingers crossed for that.

@lukepighetti these are built by a scheduled job and they come out just a few hours after upstream firebase-ios-sdk releases things. 10.20.0 was released just recently for instance, on schedule. What you're seeing is this artifact where the build itself is failing, as we're working through with 72 comments here, a couple PRs with lots of comments also, and we think a strategy that will fix it.

Hold tight and this should be sorted soon

@Salakar
Copy link
Member

Salakar commented Jan 31, 2024

Yes, was planning to reply after some sleep sorry, but Flutter should be working now on SDK 10.19 and 10.20, same integration as originally;

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.19.0'

This was tested by myself and @russellwheatley today and confirmed working for us, please try it out.

React Native has not been tested yet but in theory should work.

Make sure to run pod cache clean --all and rm -rf ios/Pods ios/Podfile.lock if you have any issues.

@josiahsrc
Copy link

josiahsrc commented Jan 31, 2024

@Salakar Exciting news!! I tested it out, however, I am unable to pin version 10.19 or 10.20 because the latest version of flutter cloud_firestore doesn't support those versions. Here is the output I'm seeing:

[!] CocoaPods could not find compatible versions for pod "FirebaseFirestore":
  In Podfile:
    FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `10.20.0`)

    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.14.0, which depends on
      Firebase/Firestore (= 10.18.0) was resolved to 10.18.0, which depends on
        FirebaseFirestore (~> 10.18.0)

Installing cloud_firestore directly from main doesn't seem to fix the issue either

@russellwheatley
Copy link
Member

russellwheatley commented Jan 31, 2024

@josiahsrc - hmmm, I thought we'd cut a release with firebase-ios-sdk 10.19.0 but it appears it hasn't gone out yet. We will be cutting a release today which contains 10.20.0. If you can't wait, you can actually change the version in your Podfile by adding the following variable that is picked up by firebase_core:

# Add the below line to your Podfile
$FirebaseSDKVersion = '10.19.0'

Just remember to remove it when FlutterFire release goes out today so it doesn't pin the firebase-ios-sdk version 👍

@russellwheatley
Copy link
Member

I saw that Paul's PR was closed without any further info? Is there any update on this?

@matt-hall-zory We have already updated the codebase with Paul's changes and some other required changes.

@russellwheatley
Copy link
Member

russellwheatley commented Jan 31, 2024

Hey FlutterFire folks, we have released the latest cloud_firestore package (depends on latest firebase_core with the latest firebase-ios-sdk version 10.20.0). If you upgrade your FlutterFire packages to the latest version and update this line in your Podfile:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.20.0'

It should work as intended. Please let me know how it goes and if you encounter any issues!

For any other platforms (i.e. React Native Firebase), could you please test and let me know how it goes? Thanks 🙏

@josiahsrc
Copy link

josiahsrc commented Jan 31, 2024

It works! Just tested again with 10.20 and everything worked flawlessly. Hello again, 19 second build times 🤩 Soooooo fast. Thanks @russellwheatley @Salakar @paulb777 and all others who helped in fixing this!

@mikehardy
Copy link
Collaborator

mikehardy commented Jan 31, 2024

This is confirmed working for react-native-firebase as well now.

I believe this is close able, but however if reality contradicts that belief in form of someone with a reproduction where it still doesn't work, obviously we can reopen and keep working away on this one

(fantastic work bringing this one home - @russellwheatley @paulb777 @Salakar - seriously)

@szotp-lc
Copy link

szotp-lc commented Jan 31, 2024

Doesn't work for me, FIrebaseFirestoreBinary target is empty, no framework, no files.

But I figured a decent workaround: use a compiled FirebaseFirestoreInternal with its dependencies & regular FirebaseFirestore, this still cuts compilation time significantly.

Here is a relevant part of Podfile for Flutter (for my workaround)

target 'Runner' do
  use_frameworks! :linkage => :static # this line is important
  use_modular_headers!

  pod 'FirebaseFirestoreInternal', :podspec => 'https://gist.githubusercontent.com/szotp-lc/da7c0fe3ed2d0c622fe62348110cb7ef/raw/8e054439082657f9b08e0a0356aa3ef67a90f87b/FirebaseFirestoreInternal.podspec'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

@mikehardy
Copy link
Collaborator

oh no - thanks for the report @szotp-lc - sadly but dutifully reopening

@mikehardy mikehardy reopened this Jan 31, 2024
@mikehardy
Copy link
Collaborator

@szotp-lc can you post the podfile contents that do not work? Might help to repro

@szotp-lc
Copy link

Project.zip

Added a project with build error and screenshot. Notice that abseil framework ins included, but FirebaseFirestore and FIrebaseFirestoreBinary are empty.

Screenshot 2024-01-31 at 17 06 33

@josiahsrc
Copy link

@szotp-lc Perhaps it's the static headers and modular headers. This is what I'm using, maybe it will work for you?

target 'Runner' do
  use_frameworks!
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.20.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

@russellwheatley
Copy link
Member

russellwheatley commented Jan 31, 2024

@szotp-lc can you post the podfile contents that do not work? Might help to repro

On top of this, please show the build output from your terminal 👌

@lukepighetti
Copy link

working for me! airdrop from heaven!!

@szotp-lc
Copy link

szotp-lc commented Feb 1, 2024

New solution doesn't include FirebaseFirestore.xcframework as vendored_framework so how it could possibly work?

https://github.com/search?q=repo%3Ainvertase%2Ffirestore-ios-sdk-frameworks%20vendored&type=code

@matt-hall-zory
Copy link

This didn't built at first. Same error as before. I had been using 10.18.0.

Error (Xcode): Undefined symbols:
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

But I did update all the relevant Firebase packages and upgraded to 10.20.0 and I was able to get it to build.

@russellwheatley
Copy link
Member

Closing out as this issue is resolved. Thank you for the patience 🙏

@felipecastrosales
Copy link

I had forgotten to give my feedback on this.

I had been unable to run my application for months due to this issue, and the version bump actually helped me. Thank you so much guys.

@jmw11x
Copy link

jmw11x commented Mar 8, 2024

I have had this issue show up today when adding firebase messaging to the flutter application I have tried all fixes and still am met with the same error. The only fix that worked was making a new flutter project and init firebase with flutter fire then bring in lib folder and import pub all new.

error produced

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy.blob(FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrate
gy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy.useDefaultKeys(FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodi
ngStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.keyDecodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy.custom(FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStra
tegy.Type) -> ((Swift.Decoder) throws -> Foundation.Date) -> FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.dataDecodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.dateDecodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.passthroughTypeResolver.setter :
FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.Type

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy.throw(FirebaseSharedSwift.FirebaseDataDecoder.Non
ConformingFloatDecodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of
FirebaseSharedSwift.FirebaseDataDecoder.nonConformingFloatDecodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.decode(_: A.Type, from: Any) throws -> A

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.userInfo.setter :
[Swift.CodingUserInfoKey : Any]

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy.blob(FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrate
gy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy.useDefaultKeys(FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodi
ngStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.keyEncodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy.custom(FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStra
tegy.Type) -> ((Foundation.Date, Swift.Encoder) throws -> ()) ->
FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.dataEncodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.dateEncodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.passthroughTypeResolver.setter :
FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.Type

Error (Xcode): Undefined symbol: enum case for
FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy.throw(FirebaseSharedSwift.FirebaseDataEncoder.Non
ConformingFloatEncodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of
FirebaseSharedSwift.FirebaseDataEncoder.nonConformingFloatEncodingStrategy.setter :
FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.encode(A) throws -> Any

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.userInfo.setter :
[Swift.CodingUserInfoKey : Any]

Error (Xcode): Undefined symbol: method descriptor for static
FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.isPassthroughType(A1) -> Swift.Bool

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro Max.

dependencies:
flutter:
sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.2
firebase_core: ^2.15.1
firebase_auth: ^4.8.0

cloud_firestore: ^4.14.0
cloud_functions: ^4.4.0
provider: ^6.0.5
flutter_spinkit: ^5.2.0
form_builder_validators: ^9.0.0-dev.1
intl: ^0.18.0
flutter_form_builder: ^9.1.0
syncfusion_flutter_datepicker: ^24.2.8
flutter_local_notifications: ^16.3.2
flutter_datetime_picker: ^1.5.0
speech_to_text: ^6.6.0
highlight_text: ^1.7.0
avatar_glow: ^3.0.1
timezone: ^0.9.2
firebase_messaging: ^14.7.10

podfile

Uncomment this line to define a global platform for your project

platform :ios, '12.0'

CocoaPods analytics sends network stats synchronously affecting flutter build latency.

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), FILE)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.18.0'
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(FILE))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet