firebase-kotlin-sdk: Linker errors when building for iOS
Hi, in my KMM project, I’ve added the following to shared/build.gradle.kts:
sourceSets {
val commonMain by getting {
dependencies {
implementation("dev.gitlive:firebase-auth:1.0.0")
...
But when I try building the iOS application, I get the following linker errors:
.app/iosApp
ld: warning: Could not find or use auto-linked framework 'GoogleDataTransport'
ld: warning: Could not find or use auto-linked framework 'FirebaseCoreDiagnostics'
ld: warning: Could not find or use auto-linked framework 'FirebaseAnalytics'
ld: warning: Could not find or use auto-linked framework 'nanopb'
ld: warning: Could not find or use auto-linked framework 'FirebaseAuth'
ld: warning: Could not find or use auto-linked framework 'FIRAnalyticsConnector'
ld: warning: Could not find or use auto-linked framework 'GoogleUtilities'
ld: warning: Could not find or use auto-linked framework 'FirebaseCore'
ld: warning: Could not find or use auto-linked framework 'GoogleAppMeasurement'
ld: warning: Could not find or use auto-linked framework 'GTMSessionFetcher'
ld: warning: Could not find or use auto-linked framework 'FirebaseInstallations'
ld: warning: Could not find or use auto-linked framework 'PromisesObjC'
Undefined symbols for architecture x86_64:
"_FIRAuthErrorDomain", referenced from:
_cocoapods_FirebaseAuth_FIRAuthErrorDomain_getter_wrapper0 in shared(result.o)
(maybe you meant: _cocoapods_FirebaseAuth_FIRAuthErrorDomain_getter_wrapper0, knifunptr_cocoapods_FirebaseAuth3_FIRAuthErrorDomain_getter )
"_OBJC_CLASS_$_FIRUser", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRMultiFactorSession", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRPhoneAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRAuthDataResult", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRGoogleAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRMultiFactorInfo", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIREmailAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRGitHubAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRFacebookAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRActionCodeSettings", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRTwitterAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRAuth", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIROAuthProvider", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIROptions", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRActionCodeInfo", referenced from:
objc-class-ref in shared(result.o)
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in shared(result.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I noticed that, when cloning the firebase-kotlin-sdk repository and trying to build firebase-auth from there, there’s an additional Carthage step which seems to download the required frameworks and link them:
*** Downloading binary-only framework FirebaseAuthBinary at "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAuthBinary.json"
… but this step doesn’t seem to happen when using dev.gitlive:firebase-auth:1.0.0 as a dependency. Is there a way to solve this issue? Thanks.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (6 by maintainers)
sorry, forgot about that part. Add a Cartfile
${rootProject.projectDir}/ios/containing the required Firebase dependencies: binary “https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json” == 6.30.0 binary “https://dl.google.com/dl/firebase/ios/carthage/FirebaseAuthBinary.json” == 6.30.0 binary “https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json” == 6.30.0 binary “https://dl.google.com/dl/firebase/ios/carthage/FirebaseFunctionsBinary.json” == 6.30.0I resolved the issue and made a sample project: https://github.com/leoull/KMM-FirebaseAuth
I think currently the library doesnt export Firebase to projects implementing it. It just tells Xcode to import the library. To add it, in your build.gradle: