Closed agatap2 closed 3 years ago
I think this is because firebase-auth depends on firebase-common which has this line it its cinterop def file: https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/7ae2717beb27250103ee97459040f8277d429b5c/firebase-app/src/iosMain/c_interop/FirebaseCore.def#L4
For the tests we have this line which means it knows where to find it: https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/7ae2717beb27250103ee97459040f8277d429b5c/firebase-app/build.gradle.kts#L66
@Reedyuk do you think we should include that for release builds too or should clients do some extra setup their end to get it working?
i think we are going to need to, most people wont know to add it independently. The error messages are pretty hard to work out that this is the issue.
So for now, what should I do to build my project in IntelliJ?
I think you need to add the linkerOps to your binaries like
linkerOpts("-F${firebase-kotlin-sdk-folder/build}/Firebase/FirebaseAnalytics")
After adding linerOpts I have another problem:
> Task :linkDebugExecutableIos FAILED
e: Could not find 'main' in '<root>' package.
When new release build will be available?
I was able to get past this error by using the following. Auth part is just because I'm using both Auth and Core.
iosX64("ios") {
binaries {
framework {
baseName = "shared"
linkerOpts("-F/path-to-firebase-kotlin-sdk/build/Firebase/FirebaseAnalytics")
linkerOpts("-F/path-to-firebase-kotlin-sdk/build/Firebase/FirebaseAuth")
}
}
}
I assume the Frameworks get included with the published package? Guessing the real question I'm wondering about is does using this library for ios force us to download our own copy of the Firebase sdk to get things working in our own app? Hopefully not, but I'm not sure what the state of the kotlin native package publishing is.
Thanks for your solution but now I receive the same error for another task: :linkDebugTestIos
I assume the Frameworks get included with the published package? Guessing the real question I'm wondering about is does using this library for ios force us to download our own copy of the Firebase sdk to get things working in our own app? Hopefully not, but I'm not sure what the state of the kotlin native package publishing is.
Yes it's a good question, I would say the state of kotlin native package publishing is fairly non-existent! In fact even using firebase in production code on iOS via Koltin Native presents a challenge at the moment as it's still early days. For example coroutines doesn't really work out of the box in KN.
Truth is, as it stands, I am not sure on the best way to publish and consume this SDK in KN. Would gladly accept guidance and suggestions on this.
@nbransby I figured, I'm happy to help if / when I discover good options. It looks like the coroutine in 1.4-M2 for native gets a lot more functional so I'm not too worried about current state limitations as I've got quite a bit of runway and willing to deal with some of the early adoption pain.
@CoreyKaylor looks like they gave up trying to get corountines to work on the current Kotlin Native memory management implementation.. https://blog.jetbrains.com/kotlin/2020/07/kotlin-native-memory-management-roadmap/
I wouldn't say they gave up. They mentioned that they would continue to support what's there, but that they're re-evaluating a better path. All positive from my point of view because it was a bit painful depending on what you were trying to do.
I tried out using the cocoapods plugin on 1.4.0-rc and it's much better than previous versions. I would definitely suggest going this route for the iosMain native libs.
https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/
Does it support the !use_frameworks flag now? As it didn't before and the firebase pods use that flag
My main application has !use_frameworks in the Podfile. I've added both 'Firebase/Auth' and 'Firebase/Core' as pod dependencies in the gradle file and it's able to compile successfully and get loaded from my ios SwiftUI application.
@CoreyKaylor - we can have a look at moving over to 1.4.0 when one of us gets a second to do it.
The other option is to put a PR with your changes and we can review and merge in.
I think there's enough change in the gradle project system for 1.4.0 that will impact this project across JS / Native that it would be a bit much for me to personally take on with the time I have available.
Ok encouraging news though, switching to pods would make things easier going forward
I double checked my setup because I was going from memory. Just so I don't send you down the wrong path. The pod dependencies were 'FirebaseCore', 'FirebaseAuth', and 'FirebaseFirestore'.
Presuming this can be closed now with the switch to Carthage? @Daeda88
I think this is more about consuming the package from a gradle dependency, not local development. The carthage piece doesn't change that. Presumably with the cocoapod enhancements, that should fix the issue if people that depend on this library for iOS also use the cocoapod plugin, or do something similar with carthage on their project.
Should be solved in 1,0,0
I have this issue on 1.0.0 @nbransby
> Configure project :core
Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.
The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets
> Task :core:generateDefNTPKit
> Task :core:podDownload UP-TO-DATE
> Task :core:generateDummyFramework
> Task :core:podspec
> Task :core:podGenIOS
> Task :core:podSetupBuildNTPKitIphonesimulator
> Task :core:podBuildNTPKitIphonesimulator
> Task :core:cinteropNTPKitIos
> Task :core:compileKotlinIos
w: /Users/matanmarciano/projects/***/core/src/commonMain/kotlin/com/***/***/core/utilities/PositionSerializer.kt: (8, 2): This declaration is experimental and its usage should be marked with '@kotlinx.serialization.ExperimentalSerializationApi' or '@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)'
w: /Users/matanmarciano/projects/***/core/src/commonMain/kotlin/com/***/***/core/utilities/RoomStateSerializer.kt: (11, 2): This declaration is experimental and its usage should be marked with '@kotlinx.serialization.ExperimentalSerializationApi' or '@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)'
> Task :core:iosProcessResources NO-SOURCE
> Task :core:iosMainKlibrary
> Task :core:compileTestKotlinIos
> Task :core:linkDebugTestIos
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: framework not found FirebaseDatabase
> Task :core:linkDebugTestIos FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':core:linkDebugTestIos'.
> Compilation finished with errors
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 13s
10 actionable tasks: 10 executed
16:50:37: Task execution finished 'allTests'.
@agatap2 any solution?
@nbransby the issue still exists in 1.2.0.
Hello, everyone! Any updates on this? I face the same issue on 1.2.0
.
I think you need to add the linkerOps to your binaries like
linkerOpts("-F${firebase-kotlin-sdk-folder/build}/Firebase/FirebaseAnalytics")
Hi. any idea where this 'firebase-kotlin-sdk-folder' directory is? I can't find it....
My main application has !use_frameworks in the Podfile. I've added both 'Firebase/Auth' and 'Firebase/Core' as pod dependencies in the gradle file and it's able to compile successfully and get loaded from my ios SwiftUI application.
Hey, maybe you could share working code? I am having really bad days while trying to figure this out :) Thanks!
Did anyone manage to get this working? I am still encountering the ld: framework not found FirebaseAuth
error and I can't really find the path that @CoreyKaylor is suggesting :(
@nbransby
I am using dev.gitlive:firebase-config:1.7.2
And I got
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: framework not found FirebaseABTesting
I was able to fix it by adding the pod separately (I wanted to use just auth but I had to add core as well).
cocoapods {
…
pod("FirebaseCore")
pod("FirebaseAuth")
}
With that I got an error
java.lang.Error: Linking globals named 'kniprot_cocoapods_FirebaseAuth0': symbol multiply defined!
which I could solve by adding a additional parameter linkOnly (that brought me the solution)
cocoapods {
…
pod("FirebaseCore", linkOnly = true)
pod("FirebaseAuth", linkOnly = true)
}
I'm getting such error while trying to build my multiplatform project on macos:
My build.gradle file: