alex_vinz
09/17/2020, 8:49 AMUndefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIROptions", 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)
Artyom Degtyarev [JB]
09/17/2020, 9:17 AM.def
file? Also, see this discussion than might be related.alex_vinz
09/17/2020, 9:23 AMkotlin {
android()
//ios()
val iosArm64 = iosArm64()
val iosX64 = iosX64("ios")
sourceSets {
val commonMain by getting
val androidMain by getting {
dependencies {
implementation("com.google.android.material:material:1.2.0")
api("com.google.firebase:firebase-common:19.3.1")
}
}
val iosMain by getting
configure(listOf(iosArm64, iosX64)) {
compilations.getByName("main") {
source(sourceSets.get("iosMain"))
val firebasecore by cinterops.creating {
packageName("cocoapods.FirebaseCore")
defFile(file("$projectDir/src/iosMain/c_interop/FirebaseCore.def"))
compilerOpts("-F$projectDir/src/iosMain/c_interop/Carthage/Build/iOS/")
}
}
}
}
cocoapods {
summary = "Shared module"
homepage = "none"
//pod("FirebaseCore")
//pod("FirebaseFirestore")
}
}
alex_vinz
09/17/2020, 9:25 AMuse_frameworks!
platform :ios, '9.0'
target 'iosApp' do
pod 'shared', :path => '../shared'
end
alex_vinz
09/17/2020, 9:29 AMld: warning: Could not find or use auto-linked framework 'GoogleDataTransport'
ld: warning: Could not find or use auto-linked framework 'FirebaseCore'
ld: warning: Could not find or use auto-linked framework 'FirebaseCoreDiagnostics'
ld: warning: Could not find or use auto-linked framework 'nanopb'
ld: warning: Could not find or use auto-linked framework 'FIRAnalyticsConnector'
ld: warning: Could not find or use auto-linked framework 'GoogleAppMeasurement'
ld: warning: Could not find or use auto-linked framework 'PromisesObjC'
ld: warning: Could not find or use auto-linked framework 'FirebaseAnalytics'
ld: warning: Could not find or use auto-linked framework 'GoogleUtilities'
ld: warning: Could not find or use auto-linked framework 'FirebaseInstallations'
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIROptions", 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 arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
alex_vinz
09/17/2020, 9:33 AMThomas
09/17/2020, 9:45 AMval firebasecore by cinterops.creating
code? Why not just uncommented the firebase pods from cocoapods and remove your cinterop code? I think that should work.alex_vinz
09/17/2020, 9:46 AMalex_vinz
09/17/2020, 11:23 AMval packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
kotlin.targets.forEach { println("name = ${it.name}") }
val framework =
kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
alex_vinz
09/17/2020, 1:01 PMplugins {
kotlin("multiplatform")
id("com.android.library")
id("kotlin-android-extensions")
kotlin("native.cocoapods")
}
group = "com.sixt.lastapp"
version = "1.0-SNAPSHOT"
repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
}
kotlin {
android()
ios()
sourceSets {
val commonMain by getting
val androidMain by getting {
dependencies {
implementation("com.google.android.material:material:1.2.0")
api("com.google.firebase:firebase-common:19.3.1")
}
}
val iosMain by getting
}
cocoapods {
summary = "Shared module"
homepage = "none"
ios.deploymentTarget = "13.2"
pod( "AFNetworking", "4.0")
}
}
android {
compileSdkVersion(29)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
versionCode = 1
versionName = "1.0"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
kotlin.targets.forEach { println("name = ${it.name}") }
val framework =
kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
Now when building in Xcode it says that cannot find AFNetwork library:
ld: framework not found AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thomas
09/17/2020, 1:07 PMThomas
09/17/2020, 1:10 PMThomas
09/17/2020, 1:10 PMalex_vinz
09/17/2020, 3:49 PMalex_vinz
09/17/2020, 3:49 PM