https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
k

kenkyee

10/03/2023, 3:50 PM
Trying to build a DMG for OSX only but it doesn't seem to run on Intel OSX machines (build machine is an M1 Mac Mini). The message is "this application is not support on this mac" but I've had no luck searching for any special configuration for x86 vs. ARM macs and the official compose-MP-template doesn't have any special config for it either: https://github.com/JetBrains/compose-multiplatform-desktop-template/blob/main/build.gradle.kts Has anyone run into this? Compose 1.5.10-beta02 if that matters...a bit puzzled because I thought it was just Java underneath. EDIT: hmm...maybe it's this: https://github.com/JetBrains/compose-multiplatform/issues/1599 EDIT: tried switching to using: _implementation_(compose.desktop.macos_x64) instead of: _implementation_(compose.desktop.currentOs) and it doesn't run on an M1 macbook 🤔
e

ephemient

10/03/2023, 6:11 PM
the problem is the process for building the dmg… the Java tools that do it don't support cross-platform https://kotlinlang.slack.com/archives/C01D6HTPATV/p1696319005969729?thread_ts=1696265757.819389&cid=C01D6HTPATV
if you run the Intel JDK on your M1 it should work though
k

kenkyee

10/03/2023, 6:13 PM
ahh..I saw a graalvm issue/ticket about supporting universal binaries on MacOS too so that makes sense. For some reason, I thought some magic binary header was just prepended to the binary since it's just Java underneath.
We did end up using an Intel macmini for our builds and it works
m

Michael Paus

10/03/2023, 6:30 PM
It’s not “just Java underneath”. Every JDK contains lots of platform specific native libraries.
k

kenkyee

10/03/2023, 6:36 PM
Yep, but I expected that to be dumped into the bootstrap into a Java JRE on the user's machine 🙂 If the JRE is bundled in the DMG, that's an entirely different thing...
t

Thomas

10/04/2023, 12:27 AM
If you run the gradle task using an Intel jdk it will build an Intel version of the app, even on the m1 Mac.
today i learned 2
k

kenkyee

10/04/2023, 12:31 AM
That's a neat workaround...never thought of doing that. Everything Rosetta...
e

ephemient

10/04/2023, 12:41 AM
that is what I said earlier though 😛
😂 3
🤦‍♂️ 3
m

Michael Paus

10/04/2023, 8:16 AM
@Thomas @ephemient Interesting! So, you are saying, that just executing something like this
Copy code
(export JAVA_HOME=~/tools/jdk_x64_mac_hotspot_17.0.8_7/Contents/Home; ./gradlew clean desktopApp:packageReleaseDmg)
in a terminal on an ARM mac would be sufficient to build an Intel version of an app? (Assuming Rosetta 2 was previously installed.) It would be kind if someone with an ARM mac could confirm this as I cannot try it out. I do not own an ARM mac yet and this concept only works in one direction.
s

spierce7

10/04/2023, 11:50 AM
I recommend looking at https://conveyor.hydraulic.dev/11.4/ It will build any version of your app on any computer. It significantly eases the burden. It's also free for open source projecgts
k

kenkyee

10/04/2023, 12:49 PM
@Sebastian Kürten also pointed this plugin out to me: https://github.com/mobanisto/pinpit-gradle-plugin That describes why the built-in Compose Multiplatform support isn't capable of building a Universal binary.
t

Thomas

10/04/2023, 9:28 PM
@Michael Paus correct, that’s how I do it. I use fastlane to build the mac app and to upload it to the store, so I just set the env var like this just before the gradle task:
ENV["JAVA_HOME"] = …
. You do need to have rosetta 2 installed ofcourse.
🙏 1
t

Tsung Wu

10/14/2023, 4:18 PM
@Michael Paus it’s much easier to install jdk with asdf. While before install it, you should run
arch -x86_64 /bin/zsh
(or bash maybe).
m

Michael Paus

10/30/2023, 8:16 PM
I just bought a new Mac Mini with an M2 Pro and I can now confirm that it is indeed possible to cross-build the Intel version of an app from this machine with this single command line
Copy code
(export JAVA_HOME=/Users/mpaus/Downloads/jdk-17.0.9+9/Contents/Home; ./gradlew clean desktopApp:packageReleaseDmg)
if JAVA_HOME is pointing to an Intel JDK here and Rosetta 2 is installed. I am still flashed that this works indeed and so easily.
👍 1
6 Views