Ahsan Ullah Rasel
02/08/2024, 2:13 PM> Task :shared:linkDebugFrameworkIosSimulatorArm64 FAILED
error: /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: warning: ignoring duplicate libraries: '-ldl'
ld: framework 'FirebaseFirestore' not found
Joel Denke
02/08/2024, 2:19 PMJoel Denke
02/08/2024, 2:20 PMJoel Denke
02/08/2024, 2:21 PMcocoapods {
ios.deploymentTarget = "12.0"
framework {
baseName = "FirebaseFirestore"
}
noPodspec()
// As of Firebase 10.17 Firestore has moved all ObjC headers to FirebaseFirestoreInternal and the kotlin cocoapods plugin does not handle this well
// Adding it manually seems to resolve the issue
pod("FirebaseFirestoreInternal") {
version = "10.19.0"
}
pod("FirebaseFirestore") {
version = "10.19.0"
extraOpts += listOf("-compiler-option", "-fmodules")
useInteropBindingFrom("FirebaseFirestoreInternal")
}
}
See https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/master/firebase-firestore/build.gradle.ktsJan Holešovský
02/09/2024, 7:01 AMAhsan Ullah Rasel
02/09/2024, 8:02 AMJoel Denke
02/09/2024, 8:04 AMJoel Denke
02/09/2024, 8:05 AMAhsan Ullah Rasel
02/09/2024, 9:22 AMJoel Denke
02/09/2024, 9:25 AMAhsan Ullah Rasel
02/09/2024, 9:56 AMJan Holešovský
02/09/2024, 10:20 AMJoel Denke
02/09/2024, 11:00 AMJan Holešovský
02/09/2024, 12:29 PMJoel Denke
02/09/2024, 12:31 PMAhsan Ullah Rasel
02/09/2024, 1:11 PMimport com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.devtoolsKsp)
alias(libs.plugins.nativeCoroutines)
alias(libs.plugins.kotlinxSerialization)
alias(libs.plugins.sqlDelight)
id(libs.plugins.buildKonfig.get().toString())
}
kotlin {
jvmToolchain(11)
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "shared"
isStatic = false
}
}
sourceSets {
all {
languageSettings {
optIn("kotlinx.cinterop.ExperimentalForeignApi")
optIn("kotlin.experimental.ExperimentalObjCName")
}
}
commonMain.dependencies {
api(libs.kmm.viewmodel.core)
api(libs.koin.core)
api(libs.koin.test)
// Ktor
implementation(libs.ktor.client.core)
implementation(libs.ktor.content.negotiation)
implementation(libs.ktor.serialization.json)
implementation(libs.ktor.logging)
// Coroutine
implementation(libs.kotlinx.coroutines.core)
// Logger
implementation(libs.napier.logging)
// SQLDelight
implementation(libs.sqldelight.runtime)
implementation(libs.sqldelight.coroutines.extension)
// Settings
implementation(libs.multiplatform.settings)
implementation(libs.multiplatform.settings.couroutine)
// Firebase
implementation(libs.firebase.firestore)
implementation(libs.firebase.common)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
}
androidMain.dependencies {
implementation(libs.ktor.client.okhttp)
// SQLDelight
implementation(libs.sqldelight.android.driver)
}
iosMain.dependencies {
implementation(libs.ktor.client.darwin)
// SQLDelight
implementation(libs.sqldelight.ios.driver)
}
}
}
android {
namespace = "com.example"
compileSdk = 34
defaultConfig {
minSdk = 28
}
}
fun readConfigProperties(): Map<String, String> {
val items = HashMap<String, String>()
val fl = rootProject.file("config.properties")
if (fl.exists()) {
fl.forEachLine {
items[it.split("=")[0]] = it.split("=")[1]
}
}
return items
}
val configProperties = readConfigProperties()
buildkonfig {
packageName = "com.example"
defaultConfigs {
buildConfigField(STRING, "API_KEY", configProperties["api_key"])
}
}
sqldelight {
databases {
create("AppDatabase") {
packageName.set("com.example.shared.cache")
}
}
}
Ahsan Ullah Rasel
02/09/2024, 1:12 PMfirebase-common = { module = "dev.gitlive:firebase-common", version.ref = "firebaseFirestore" }
firebase-firestore = { module = "dev.gitlive:firebase-firestore", version.ref = "firebaseFirestore" }
Ahsan Ullah Rasel
02/09/2024, 1:13 PMAhsan Ullah Rasel
02/09/2024, 1:15 PMJoel Denke
02/09/2024, 1:15 PMJoel Denke
02/09/2024, 1:16 PMAhsan Ullah Rasel
02/09/2024, 1:20 PMJoel Denke
02/09/2024, 1:20 PMAhsan Ullah Rasel
02/09/2024, 1:24 PMJoel Denke
02/09/2024, 1:25 PMJoel Denke
02/09/2024, 1:25 PMJoel Denke
02/09/2024, 1:26 PMJan Holešovský
02/09/2024, 1:36 PMios {
binaries {
framework {
baseName = "shared"
// when there is a linking error, show even the command line that lead to the error
freeCompilerArgs += listOf("-Xverbose-phases=Linker")
}
}
}
To the the kotlin {...}
and re-try the build? That won't fix that, but will give more info - the actual command line the ld was issued with.Ahsan Ullah Rasel
02/09/2024, 3:53 PM