Hi everyone, I'm trying to set up packaging for my...
# multiplatform
d
Hi everyone, I'm trying to set up packaging for my multiplatform project, since I'm using Apple silicon to build dmg installation I noticed it is only for apple chips, and people can't install it on Intel based Macs, how can I create Intel based installations?
Copy code
compose.desktop {
    application {
        mainClass = "racing.telemetry.MainKt"

        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "Racing Telemetry"
            packageVersion = "1.0.2"

            // macOS icon
            macOS {
                iconFile.set(project.file("src/nativeMain/resources/telemetry.icns"))
            }

            // Windows icon
            windows {
                iconFile.set(project.file("src/nativeMain/resources/telemetry.ico"))
                // Configure menu group
                menuGroup = "Racing Telemetry"

                // Enable desktop shortcut dialog
                shortcut = true

                // Enable start menu shortcut
                menu = true

            }


            linux {
                iconFile.set(project.file("src/nativeMain/resources/telemetry.png"))
            }
             modules("java.naming")
        }
    }
}
e
unfortunately Compose Desktop uses jpackage and jpackage does not support any type of cross-building. but you can install an Intel JVM with Rosetta - if you run the Gradle build with it, you should get an Intel DMG out
🙌 2
m
That’s what I used in the past on an ARM mac. Set
JAVA_HOME
to an appropriate Intel-JDK and then just call
gradlew
.
Copy code
(export JAVA_HOME=/Users/mpaus/Downloads/jdk-17.0.9+9/Contents/Home; ./gradlew clean desktopApp:packageReleaseDmg)
👍 2
d
Copy code
/Applications/TelemetryRacing.app/Contents/MacOS/TelemetryRacing ; exit;
dlopen(/Applications/TelemetryRacing.app/Contents/runtime/Contents/Home/lib/libjli.dylib) failed. Error: dlopen(/Applications/TelemetryRacing.app/Contents/runtime/Contents/Home/lib/libjli.dylib, 0x0001): tried: '/Applications/TelemetryRacing.app/Contents/runtime/Contents/Home/lib/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Applications/TelemetryRacing.app/Contents/runtime/Contents/Home/lib/libjli.dylib' (no such file), '/Applications/TelemetryRacing.app/Contents/runtime/Contents/Home/lib/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64'))
Looks like swapping JAVA only work partially it create intel based installer, however I can't run it on intel mac :(
m
It can also run if the build was done right. I just did it again myself with my own app and it worked. Installation and execution of the application. But you have to be careful not to pull in a wrong non-Intel JDK anywhere. This might happen, for example, in the compose.desktop.application block in the build script where you can specify a specific JDK for building the app.