r

    rocketraman

    1 year ago
    Trying to include FirebaseAuth as a cocoapods dependency on my shared lib:
    cocoapods {
        summary = "x"
        homepage = "x"
        frameworkName = "shared"
        ios.deploymentTarget = "13.0"
        pod("FirebaseAuth", "~> 7.6.0")
      }
    but the build fails at
    linkDebugFrameworkIosX64
    with:
    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.
    c

    clark

    2 months ago
    I know it has been a while since you experienced this issue, but I'm seeing basically the same error now myself. My
    Podfile
    in my
    ios
    directory does not specify any pod dependencies. In my shared
    build.gradle.kts
    I specify
    pod("FirebaseAuth", "~> 8.14.0")
    because it seems that that is the version being used by GitLive Firebase Kotlin SDK in v1.6.10 (link for reference). When I don't include that pod in my build.gradle file, and I try to build for iOS, I get:
    ld: framework not found FirebaseAuth
    When I do include it and try to build for iOS, I get:
    e: Compilation failed: Linking globals named 'kniprot_cocoapods_FirebaseAuth0': symbol multiply defined!
    Any further guidance on how you solved this issue would be greatly appreciated!
    r

    rocketraman

    2 months ago
    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:
    // 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

    clark

    2 months ago
    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.
    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

    rocketraman

    2 months ago
    Just haven't updated in a while
    As a point of comparison, I don't have
    isStatic = false
    . In your podfile do you have
    use_frameworks!
    ?
    c

    clark

    2 months ago
    Good to note. I do have
    use_frameworks!
    in my Podfile.
    r

    rocketraman

    2 months ago
    Do you have a reference to
    dev.gitlive:firebase-auth
    in your
    commonMain
    source set?
    c

    clark

    2 months ago
    val commonMain by getting {
      .
      .
      .
      // Firebase KMP (3rd party OSS)
      implementation("dev.gitlive:firebase-auth:1.6.1")
    }
    r

    rocketraman

    2 months ago
    Looks pretty much the same though we're still on
    1.4.3
    .
    c

    clark

    2 months ago
    Did you add the carthage related code to your build.gradle file from firebase-kotlin-sdk issue #111?
    r

    rocketraman

    2 months ago
    No, don't use carthage
    I'm assuming you tried the usual stuff with resetting cocoapods? Something like:
    rm -rf ~/Library/Developer/Xcode/DerivedData/
    rm -rf ~/Library/Caches/CocoaPods/
    cd iosApp
    pod deintegrate
    rm -rf iosApp.xcworkspace/
    pod update
    c

    clark

    2 months ago
    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

    rocketraman

    2 months ago
    No, don't need
    packForXcode
    if you use cocoapods
    c

    clark

    2 months ago
    We don't have our project set up as cocoapods dependency for iOS. But maybe that is the issue.
    r

    rocketraman

    2 months ago
    Definitely. Do something like this in
    cocoapods
    in build.gradle.kts:
    cocoapods {
      framework {
        baseName = "shared"
      }
    }
    and then in Podfile:
    target 'iosApp' do
      pod 'shared', :path => '../shared'
      ...
    end
    c

    clark

    2 months ago
    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
    ld: framework not found FirebaseAuth
    But if I do include it, then I start getting some other weird error:
    Exception in thread "main" java.lang.Error: /var/folders/sy/kt1x1x3s7tnc93dj8b1bzbdc0000gn/T/6822736881599445461.m:1:9: fatal error: module 'Firebase' not found
    RESOLVED: I ended up just being able to use Swift Package Manager to import the firebase-ios-sdk packages and by setting the binaries frameworks to be statically linked, it all worked! I found the answer in issue #288 for the firebase-kotlin-sdk-repo.