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

Mark Alvaro

10/17/2023, 2:19 PM
Hi there! Using compose desktop to build an app that will run on Mac and Linux. The packageDmg-generated dmg works fine. However when I try to install the deb package on Ubuntu, I get an error about unmet dependencies. Ubuntu doesn't give any clues as to what is missing. Any ideas what I could be missing? Pasting more info in thread.
Copy code
kotlin.version=1.6.10
agp.version=7.3.0
compose.version=1.1.0
Copy code
compose.desktop {
    application {
        mainClass = "my.MainKt"

        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "my-app"
            packageVersion = "1.0.0"
            includeAllModules = true
        }
    }
}
Copy code
plugins {
    kotlin("multiplatform")
    id("org.jetbrains.compose")
}
Was using a newer version of kotlin/compose, but downgraded because I couldn't get the dmg to work, so I copied an older project of mine's configuration. Unfortunately I never tried to get the old one to work on Linux.
I've installed a jre and jdk on the Linux box.
Found a little bit of help from Google and now realize it is probably an arch issue. Anyway to specify use amd when building from an arm?
m

Michael Paus

10/17/2023, 2:56 PM
It is much more likely to get help for the current versions than for these ancient ones.
m

Mark Alvaro

10/17/2023, 3:05 PM
Got past it by building on the Ubuntu box itself, but still curious even with new versions if you can build an amd package from an arm laptop. Struggling to find any docs or posts about that.
k

Kirill Grouchnikov

10/17/2023, 3:19 PM
The safest bet is to always build for a specific platform on that platform.
👍 1
s

Sebastian Kürten

10/17/2023, 3:46 PM
Building for other architectures is not supported by the Compose Gradle plugin and it cannot support that while it still utilizes
jpackage
for packaging as that tool in turn does not support cross-compilation (it is a non goal for the tool as specified here: https://openjdk.org/jeps/343#Non-Goals) I started a project that intends to go around that limitation by pulling the functionality of
jpackage
into the packaging plugin. It still relies on JDK tooling, but uses
jlink
instead which is able to package JVM runtimes for other operating systems and architectures. The tool is a new plugin called pinpit that can be used in conjunction with the compose plugin. I'm already using it in production, here's more info on it: https://github.com/mobanisto/pinpit-gradle-plugin and https://github.com/mobanisto/pinpit (second tool is for creating a working template project to get off the ground quickly with a new project). Your alternatives are: • Running your builds on various different machines with the architectures you want to package for • Using github runners (although I think they do not support linux arm for example) • using another 3rd party tool called Conveyor: https://conveyor.hydraulic.dev/11.4/
👍 4
m

Mark Alvaro

10/17/2023, 4:47 PM
Awesome thank you for the info! Will look into pinpit.
2 Views