Update on KMM not working on arm64 simulator on M1...
# multiplatform
r
Update on KMM not working on arm64 simulator on M1 Macbook: I previously posted about having issues with KMM framework file generated by the Cocoapods gradle plugin working with the arm64 simulator target on iOS. After suggestions in this thread, I stopped using the cocoapods plugin and switched to XCFramework which included the arm64 simulator target. This did not work on the simulator. Instead, I was only able to get simulator with my KMM project working if I opened Xcode with Rosetta to run the x64 simulator target. If anyone has any suggestions on how to get the arm64 simulator target to work, let me know.
h
Do you have a reproducer? for example, my playground app creates a xcframework for arm, which works on the simulator... https://github.com/hfhbd/ComposeTodo
t
A snippet from your gradle would be handy. Here is mine, which works for me:
Copy code
configure(listOf(
        iosArm32(),
        iosArm64(),
        iosX64(),
        iosSimulatorArm64()
    )) {
        binaries {
            framework {
                baseName = "Shared"
                embedBitcode("bitcode")
                xcf.add(this)
            }
        }
    }
đŸ‘€ 1
u
how do you build the iOS App? with xcode or gradle?
i.e. Do you have something like this in your XCode project?
Copy code
ARCHS[sdk=iphonesimulator*]: x86_64
    EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64
Do you have any dependencies that do not provide an arm64 simulator target?
t
1. I use Xcode, with the xcframework built above dragged and dropped into the project. 2. I currently do not have any excluded arch 3. I use MLKit for Barcode scanning, which currently does not have an M1 Sim target, so that one I have to use device. In another project that uses the same shared KMP module, it runs fine in M1 sim
u
Then, obviously your app can not run on a native arm64 simulator if one of the dependencies (MLKit) does not exist for that target. I see nothing KMM could do about it.
t
Agreed. The original question appeared to be centered around an issue building a KMM module for M1 sim. So not sure what third party dependencies have to do with it.
u
This thread stars with the statement that the author can only get his app to run when she starts xcode with Rosetta to run the x64 simulator target. Just pointing out this is expected if parts of the app are only available for x64 simulator
Maybe let’s ask @Rachel Carandang is the issue clear for you? Are your questions answered? If not, please let us know what is open to you.
249 Views