Realm Kotlin `0.8.0` has been released :tada: we a...
# realm
n
Realm Kotlin
0.8.0
has been released 🎉 we added support for Kotlin 1.6, M1 Silicon and Dates (via
RealmInstant
) full change log here
🎉 3
👍 1
j
Perhaps expected right now but getting following when trying to run Compose for Desktop application that uses the library on M1 device (
incompatible architecture (have 'x86_64', need 'arm64e')
)
Copy code
java.lang.UnsatisfiedLinkError: /Users/joreilly/Library/Caches/io.realm.kotlin/1d98d42d9af8c59bc9cf6ee93d287b442833b592/librealmc.dylib: dlopen(/Users/joreilly/Library/Caches/io.realm.kotlin/1d98d42d9af8c59bc9cf6ee93d287b442833b592/librealmc.dylib, 0x0001): tried: '/Users/joreilly/Library/Caches/io.realm.kotlin/1d98d42d9af8c59bc9cf6ee93d287b442833b592/librealmc.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/librealmc.dylib' (no such file)
n
I think you need to specify the
macosArm64
target similarly to what we do for ios. This is working for me
Copy code
val macosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = when {
        System.getenv("NATIVE_ARCH")?.startsWith("arm") == true -> ::macosArm64
        else -> ::macosX64
    }
    macosTarget("macos") {}
j
ah, that makes sense....let me try that
hmm, that didn't work.....I guess this isn't related to the app specifically supporting macos target.....it's running Compose for Desktop app that at least primarily needs
jvm
n
jvm
should run as usual the
x86_64
Shared Object will run via rosetta. Let me push an example where all these targets works so you can double check
j
ok, thanks
n
j
I get the same error with that sample here. fwiw I'm running using following
perhaps needs to be run a particular way for rosetta stuff to kick in?
n
I was running from the command line like instructed from the Readme. I think the latest Android Studio uses Arm64 so running a Grade task from it may not trigger the compatibility layer I guess
j
I get same error if I run
./gradlew :jvmApp:run
(on command line)....maybe related to JDK used?
this is what I have fwiw
Copy code
java --version
openjdk 11.0.13 2021-10-19 LTS
OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)
n
Hmm it's working on my side. can you try empty the cache of the JVM apps
rm -rf ~/Library/Caches/io.realm.kotlin/
this will force unbundling the .so again for the Jar
also running
Copy code
java -version
]java version "11.0.12" 2021-07-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.12+8-LTS-237)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.12+8-LTS-237, mixed mode)
realm@administrators-Mac-mini-2 MultiplatformDemo % ]
On Big Sur
11.6.2 (20G314)
j
I'm on Monterey
12.1
fact that I'm using JDK that specifically supports apple silicon might be the difference? (https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit&package=jdk)
e.g.
n
Ah good point
We'll add another SO crosscompiled for Arm64 so we can extract it on Arm macos
👍 1
j
I guess Apple weren't thinking too much of disruption their M1 devices would have to the world of Kotlin Multiplatform 🙂
n
I wonder if there's a mod where you can force run a program in compatibility mode (it could be a safe fall back if the binary was not compiled for Arm)?
j
yeah, was wondering something along the same lines but didn't see anything yet