Hi. JB-Compose is pretty cool. I want to use it fo...
# compose-desktop
a
Hi. JB-Compose is pretty cool. I want to use it for an embedded linux project. Is there going to be a ARM 64-bit packaging target ?
j
When you say ARM-64, are you referring to a raspberry pi or something else?
a
It's yocto Linux for one of these boards. But I think that shouldn't make a difference, right? If we have the proper graphics driver with open GL ES Implementation. https://www.variscite.com/product/system-on-module-som/cortex-a53-krait/var-som-mx8m-mini-nxp-i-mx8m-mini/
j
Thanks for the info, it's helpful as we do planning. Knowing the exact platforms people want is often helpful because in theory it wouldn't make a difference, but... in theory there is no difference between theory and practice, but in practice there is. We've gotten a few requests for Raspberry Pi, and hopefully that would work here too. As @suresh mentioned, there is no official support for arm64 yet, but everything is open source, so a motivated individual could do a build on that platform. No concrete plans to support yet, but it seems likely to happen eventually given that there have been several requests at this point.
o
Generally Compose for Desktop is pure JVM code, all native code (i.e. Skia bindings) is collected in https://github.com/JetBrains/skiko so someone will provide port of that library - adding support to Compose is pretty straightforward
j
Yeah, to be clear for those following along at home, @Aru's use case would continue to use the JVM bindings (not require new native bindings) but would need a build of Skia for arm64.
a
So, I build Skia for arm64, build
skiko
with bindings for arm64 Skia and Compose for Desktop should work. And Skia should compile with ease for arm64 given that it's being used in Fuchsia.
j
Yes, that's all correct. In addition to Fuchsia, both Flutter and Android build Skia on arm64, so it should be entirely supported/possible. Although having said that, I've never seen anyone describe Skia as compiling (regardless of platform) with "ease". 🤣 . But yes, there is no reason to assume it wouldn't more or less "just work" if you're brave/motivated enough to compile Skia.
😃 2
o
well, we have set of scripts to simplify Skia compilation: https://github.com/JetBrains/skia-build
a
Sweet.
So, I've compiled skia for arm64. Do I need to compile
skija
separately and then compile
skiko
or just building skiko is enough? Also, do I need
Skia-linux-Release-arm64.zip
in the target system or will skiko build-output will have it packaged ?
o
Guess best approach would be to send PR with linux-arm64 build script to skia-build and then adjust Skiko. No need to do anything in Skija. Target system doesn’t need to have .zip archive, as Skiko build takes care about packaging Skia into JNI library.
Also did you do cross-build on use Raspberry for Skia builds?
In https://github.com/JetBrains/skiko/pull/43 I did some improvements for cross-compilation.
a
Hey thanks for this PR. I didn't do cross-build for Raspberry PI. It is for a System-on-Module based on NXP i.MX processor (link on top of this thread). I was fitting the build inside a Yocto Recipe but cross compilation was smooth by passing
cxx=\"$CXX\"         cc=\"$CC\"
in the args. Similarly I'll have to pass in the native toolchain with a sysroot for cross compilation for Skiko as well.
o
Generally, if you’ll provide Skia build scripts and build instructions we could reproduce - we could build Skiko for linux-arm64 targets as well
a
Alright. I'll create a PR for
skia-build
to cross-compile to linux-arm64.
I looked into adjusting the gradle build script for skiko to use a cross-compiler like
aarch64-linux-gcc
instead of
gcc
toolchain. It's not straight forward and gradle itself does not support configuring a custom toolchain yet.
Posting here for continuity. I've looked at the gradle file for skiko and wrote a CMakeFiles.txt that would generate
libskiko-linux.so
in a similar way and packaged that into
skiko-linux-arm64-0.0.0-SNAPSHOT.jar
. With a big satisfaction, I wanted to test the "Hello world" code in the embedded device and copied the jars over and ran it. I got
Copy code
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Library file libskija.so not found in /
        at org.jetbrains.skija.impl.Library._extract(Library.java:85)
        at org.jetbrains.skija.impl.Library.load(Library.java:50)
        at org.jetbrains.skija.impl.Library.staticLoad(Library.java:32)
        at org.jetbrains.skija.PictureRecorder.<clinit>(PictureRecorder.java:8)
        ... 18 more
Caused by: java.lang.IllegalArgumentException: Library file libskija.so not found in /
        at org.jetbrains.skija.impl.Library._extract(Library.java:68)
        ... 21 more
I thought skija is not needed if skiko is compiled? Is that not the case ?
j
Skiko is a Kotlin MPP binding around Skija (for JVM), and doesn't (yet) provide any other native skia bindings. In the future, Skiko may also provide bindings through KotlinNative that bind directly to Skia, but that is not yet implemented.
So to answer your question: You do still need Skija because Skija is a dependency of Skiko. And you need Skia because Skia is a dependency of Skija.
a
I am running it on a JVM only. So, I need something like below:
Copy code
.
├── compose-example.jar
├── skiko-jvm-0.1.18.jar
├── skiko-jvm-runtime-linux-arm64-0.1.18.jar
│   ├── libskiko.so  <-- This has SKIKO & SKIJA objects along with SKIA bindings
│   ├── libskiko.so.sha256
│   ├── org.jetbrains.skija
│   └── org.jetbrains.skiko
└── libskija.so
obviously with other jars for kotlin runtime and androidx