Reputation: 307
While compiling a Multiplatform Project with some simple @Serializable classes, such as:
@Serializable
data class Something(
val value: Int,
val otherValue: String,
)
to the iosApp target, the following error occurs:
ld: warning: search path '/Users/lancylot2004/Desktop/ActiveApp/iosApp/../shared/build/xcode-frameworks/Debug/iphonesimulator17.5' not found
Undefined symbols for architecture arm64:
"_kfun:utils.Mutations.Something.Companion#serializer(){}kotlinx.serialization.KSerializer<utils.Mutations.Something>", referenced from:
_kfun:utils#saveSomething(utils.Mutations.Something){} in ComposeApp[2](ComposeApp.framework.o)
_kfun:utils#getSomething(){}utils.Mutations.Something? in ComposeApp[2](ComposeApp.framework.o)
_objc2kotlin_kfun:utils.Mutations.Something.Companion#serializer(){}kotlinx.serialization.KSerializer<utils.Mutations.Something> in ComposeApp[2](ComposeApp.framework.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
While no error occurs for the composeApp (i.e., Android) target whatsoever. I am aware that there is a warning for not being able to find the simulator search path, but so far that doesn't seem to be the issue. Please correct me if I'm wrong!
My gradle files are:
{root}/build.gradle.kts
plugins {
/// ...
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.20-Beta2" apply false
}
composeApp/build.gradle.kts
plugins {
/// Since specifying version directly causes "unknown existing version" error
id(libs.plugins.kotlin.serialization.get().pluginId)
}
/// ...
kotlin {
/// ...
sourceSets {
commonMain.dependencies {
/// ...
implementation(libs.kotlinx.serialization.json)
}
}
}
libs.versions.toml
/// ...
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
Upvotes: 0
Views: 225
Reputation: 307
After searching through many SO and Slack posts, I found out from here that this is an issue specific (currently) to Kotlin (and therefore plugins) >2.0.0
. Downgrading resolves the issue.
Upvotes: 1