Trying to include FirebaseAuth as a cocoapods depe...
# multiplatform
r
Trying to include FirebaseAuth as a cocoapods dependency on my shared lib:
Copy code
cocoapods {
    summary = "x"
    homepage = "x"
    frameworkName = "shared"
    ios.deploymentTarget = "13.0"
    pod("FirebaseAuth", "~> 7.6.0")
  }
but the build fails at
linkDebugFrameworkIosX64
with:
Copy code
error: Linking globals named 'cocoapods_FirebaseAuth_FIRAuthErrorDomain_getter_wrapper0': symbol multiply defined!
This was working fine with an older version of FirebaseAuth.
I think it's because I use GitLive Firebase Kotlin SDK in my project, and it references FirebaseAuth 7.3.0. I was also referencing FirebaseAuth in my
cocoapods
section (as I have some platform-specific code in iosMain in my shared lib), and there was a symbol conflict of some type. May also be related to how Firebase is linked: https://github.com/firebase/firebase-ios-sdk/blob/master/docs/firebase_in_libraries.md. Removing
FirebaseAuth
from my cocoapods definition has solved the problem.
Somehow our build works, even though I don't think it should be! This is the comment I have in our
cocoapods
section in our shared `build.gradle.kts`:
Copy code
// We don't reference FirebaseAuth here, because firebase-kotlin-sdk references and there appears to be some
    // strangeness happening at link time when adding the dependency here also:
    // error: Linking globals named 'cocoapods_FirebaseAuth_FIRAuthErrorDomain_getter_wrapper0': symbol multiply defined!
    // -- the build appears to work fine without this here, though I'm not exactly sure why as we have code that
    // references it.
    // see also: <https://github.com/GitLiveApp/firebase-kotlin-sdk/issues/111>
    //pod("FirebaseAuth", "~> 8.11.0")
Check your ios Podfile and import Firebase/Auth there e.g.
pod 'Firebase/Auth', '~> 8.11.0'
c
No luck moving it to the
Podfile
This is my current cocoapods configuration in
build.gradle.kts
. I have tried every combination of having both of the commented out lines being enabled or not and nothing working quite yet.
Copy code
cocoapods {
        summary = "*"
        homepage = "*"
        framework {
            isStatic = false // for SwiftUI preview
        }
        //  pod("FirebaseAuth", "~> 8.14.0")
        ios.deploymentTarget = "13.5"
        //  podfile = project.file("../ios/Podfile")
    }
Using kotlin version
1.7.0
Is there a reason you use version
8.11.0
instead of
8.14.0
?
r
Just haven't updated in a while
👍 1
As a point of comparison, I don't have
isStatic = false
. In your podfile do you have
use_frameworks!
?
c
Good to note. I do have
use_frameworks!
in my Podfile.
r
Do you have a reference to
dev.gitlive:firebase-auth
in your
commonMain
source set?
c
Copy code
val commonMain by getting {
  .
  .
  .
  // Firebase KMP (3rd party OSS)
  implementation("dev.gitlive:firebase-auth:1.6.1")
}
r
Looks pretty much the same though we're still on
1.4.3
.
c
Did you add the carthage related code to your build.gradle file from firebase-kotlin-sdk issue #111?
r
No, don't use carthage
I'm assuming you tried the usual stuff with resetting cocoapods? Something like:
Copy code
rm -rf ~/Library/Developer/Xcode/DerivedData/
rm -rf ~/Library/Caches/CocoaPods/
cd iosApp
pod deintegrate
rm -rf iosApp.xcworkspace/
pod update
c
I've only been doing the
pod deintegrate
step and cleaning gradle builds
I'll try those out
One other thing is we never use FirebaseAuth directly in iOS. Not sure if that would make a difference
Also, do you test by building your app or running the
packForXcode
gradle task?
r
No, don't need
packForXcode
if you use cocoapods
c
We don't have our project set up as cocoapods dependency for iOS. But maybe that is the issue.
r
Definitely. Do something like this in
cocoapods
in build.gradle.kts:
Copy code
cocoapods {
  framework {
    baseName = "shared"
  }
}
and then in `Podfile`:
Copy code
target 'iosApp' do
  pod 'shared', :path => '../shared'
  ...
end
c
Giving this a try now. Will update when I have results.
So I have my shared code imported as a Cocoapod now
If I don't include the `pod("Firebase/Auth", "~> 8.14.0") in my shared
build.gradle.kts
then I get the
Copy code
ld: framework not found FirebaseAuth
But if I do include it, then I start getting some other weird error:
Copy code
Exception in thread "main" java.lang.Error: /var/folders/sy/kt1x1x3s7tnc93dj8b1bzbdc0000gn/T/6822736881599445461.m:1:9: fatal error: module 'Firebase' not found
134 Views