https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
m

Moussa

02/15/2023, 2:37 PM
Hey everyone 👋, Running
linkPodDebugFrameworkIosFat
gives me
Copy code
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/moussa/Desktop/MoussaWork/Companies/IOHK/atala-prism-apollo/base-asymmetric-encryption/build/bin/iosArm64/podDebugFramework/ApolloBaseAsymmetricEncryption.framework/ApolloBaseAsymmetricEncryption and /Users/moussa/Desktop/MoussaWork/Companies/IOHK/atala-prism-apollo/base-asymmetric-encryption/build/bin/iosX64/podDebugFramework/ApolloBaseAsymmetricEncryption.framework/ApolloBaseAsymmetricEncryption have the same architectures (arm64) and can't be in the same fat output file
Error simplified,
iosArm64
&
iosX64
have the same architectures (arm64) and can’t be in the same fat output file. How do I investigate this error or at least try to figure out the root cause of that issue? Notes: • Using the iOS new hierarchy only
ios()
d

Daniel Seither

02/15/2023, 3:06 PM
The problem you’re likely running into here is that Apple Silicon Macs (M1, M2) and iPhones are using the same architecture (arm64), meaning that you can’t put a simulator build (to be run on a Mac) and a device build (to be run on a phone/tablet) into the same framework binary anymore. Apple’s solution for this is XCFrameworks, which is a directory structure containing multiple frameworks. See also https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks for how to do this. I wonder why it says
iosArm64
and
iosX64
though, because the latter shouldn’t have the
arm64
architecture. Have you maybe mixed up
iosX64
(which is the simulator build for Intel Macs) and
iosSimulatorArm64
somewhere?
m

Moussa

02/15/2023, 3:32 PM
@Daniel Seither I understand. But, I’m not doing anything different than having ios source set so this is really weird that is passing in other modules with the same configuration
d

Daniel Seither

02/15/2023, 4:02 PM
I’m sorry, I’m an iOS dev and not a Gradle expert in any way. Maybe someone with more knowledge of the KMM build config can take a look here?
m

Moussa

02/20/2023, 12:54 PM
Workaround: I ignore that task for now until I get a better handle on it. It could be caused by removing
iosSimulatorArm64
Copy code
tasks.matching {
    fun String.isOneOf(values: List<String>): Boolean {
        for (value in values) {
            if (this == value) {
                return true
            }
        }
        return false
    }

    it.name.isOneOf(
        listOf(
            "linkPodReleaseFrameworkIosFat",
            ":linkPodReleaseFrameworkIosFat", "linkPodDebugFrameworkIosFat",
            ":linkPodDebugFrameworkIosFat"
        )
    )
}.all {
    this.enabled = false
}
42 Views