Martin Rajniak
11/22/2021, 8:11 PMthe linked and embedded framework is missing one or more architectures required by this target: arm64
I am using M1 Mac and trying to run it with simulator so that will be an issue (since we see no issue on other architectures).
The weird part is that the template task mentions arm64 architecture:
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"
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)
}
When I try KMM project I don't have this problem (but then the library is linked, so it is a different scenario).
Any ideas or experience with this?Artyom Degtyarev [JB]
11/23/2021, 7:25 AMpackForXcode
task might be an obsolete practice: https://blog.jetbrains.com/kotlin/2021/07/multiplatform-gradle-plugin-improved-for-connecting-kmm-modules/
Even from the code you share, it determines Device and Simulator by the SDK name prefix, which is not taking iosSimulatorArm64 into the count - that one target has iphonesimulator
SDK name prefix and Arm64
target name suffix.
If you also want to get more info about how the embedAndSignAppleFrameworkForXcode
task defines targets to work with M1 simulators correctly, consider looking at https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plug[…]kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/apple/AppleSdk.ktMartin Rajniak
11/23/2021, 8:30 AMArtyom Degtyarev [JB]
11/23/2021, 8:34 AMMartin Rajniak
11/23/2021, 9:50 AM