Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile for raspberry arm64 linux ? #1170

Closed
toplinuxsir opened this issue Sep 16, 2021 · 6 comments
Closed

How to compile for raspberry arm64 linux ? #1170

toplinuxsir opened this issue Sep 16, 2021 · 6 comments
Assignees
Labels
desktop linux question Not a bug, but question or comment
Milestone

Comments

@toplinuxsir
Copy link

I compiled in linux x86_64 platform , when run from raspberry pi arm64 linux , error as below :

Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.jetbrains.skiko.SkiaLayer.<init>(SkiaLayer.kt:40)
	at org.jetbrains.skiko.SkiaLayer.<init>(SkiaLayer.kt:23)
	at androidx.compose.ui.awt.ComposeLayer$Wrapped.<init>(ComposeLayer.desktop.kt:81)
	at androidx.compose.ui.awt.ComposeLayer.<init>(ComposeLayer.desktop.kt:62)
	at androidx.compose.ui.awt.ComposeWindowDelegate.<init>(ComposeWindowDelegate.desktop.kt:37)
	at androidx.compose.ui.awt.ComposeWindow.<init>(ComposeWindow.desktop.kt:36)
	at androidx.compose.ui.window.Window_desktopKt$Window$3$1.invoke(Window.desktop.kt:138)
	at androidx.compose.ui.window.Window_desktopKt$Window$3$1.invoke(Window.desktop.kt:137)
	at androidx.compose.ui.window.Window_desktopKt$Window$10.invoke(Window.desktop.kt:309)
	at androidx.compose.ui.window.Window_desktopKt$Window$10.invoke(Window.desktop.kt:308)
	at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:75)
	at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:74)
	at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:81)
	at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:780)
	at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:638)
	at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:733)
	at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:432)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:176)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find libskiko-linux-arm64.so.sha256, proper native dependency missing.
	at org.jetbrains.skiko.Library.load(Library.kt:71)
	at org.jetbrains.skiko.HardwareLayer.<clinit>(HardwareLayer.kt:10)

@toplinuxsir
Copy link
Author

No support for raspberry linux ?

@akurasov akurasov added desktop linux question Not a bug, but question or comment labels Sep 27, 2021
@akurasov
Copy link
Contributor

Could you share your build.gradle file here?
Do you have dependency implementation(compose.desktop.currentOs) there?

@akurasov akurasov self-assigned this Sep 27, 2021
@akurasov akurasov added the wait for reply Further information is requested label Sep 27, 2021
@olonho
Copy link
Contributor

olonho commented Sep 27, 2021

It depends on how did you run, dependency must include linux_arm64 Skiko library.

@toplinuxsir
Copy link
Author

@akurasov

import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile


plugins {
    kotlin("jvm") version "1.5.21"
    // id("org.jetbrains.compose") version "0.5.0-build270"
    id("org.jetbrains.compose") version "1.0.0-alpha3"
    id("org.jetbrains.kotlin.plugin.noarg") version "1.5.21"
}

group = "me.lhs"
version = "1.0"

repositories {
    jcenter()
    google()
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
    maven {
        url = uri("https://repository.apache.org/content/repositories/snapshots")
        mavenContent {
            snapshotsOnly()
        }
    }

}

dependencies {
    implementation(compose.desktop.currentOs)
    implementation("org.apache.plc4x:plc4j-api:0.9.0-SNAPSHOT")
    runtimeOnly("org.apache.plc4x:plc4j-driver-s7:0.9.0-SNAPSHOT")
    implementation("org.slf4j:slf4j-api:1.7.32")
    implementation("org.slf4j:slf4j-simple:1.7.32")
    // https://mvnrepository.com/artifact/org.zeromq/jeromq
    implementation("org.zeromq:jeromq:0.5.2")
    // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
    implementation("com.squareup.okhttp3:okhttp:4.9.1")
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.4")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.4")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
    // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-jdk8
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.5.1")

    // https://mvnrepository.com/artifact/com.arkivanov.decompose/decompose
    // runtimeOnly("com.arkivanov.decompose:decompose:0.2.6")
// https://mvnrepository.com/artifact/com.arkivanov.decompose/extensions-compose-jetpack
    // implementation("com.arkivanov.decompose:extensions-compose-jetpack:0.2.6")

    // https://mvnrepository.com/artifact/com.arkivanov.decompose/extensions-compose-jetbrains
    // implementation("com.arkivanov.decompose:extensions-compose-jetbrains:0.2.6")


    // https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.4")

}

tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "1.8"
}


compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "PlcReader"
            packageVersion = "1.0.0"
        }
    }
}

@Martinsbl
Copy link

If anyone else stumbles over this; I got the same error as OP and thanks to @akurasov I figured out that I could replace
implementation(compose.desktop.currentOs)
with
implementation(compose.desktop.linux_arm64)

I could then successfully build the project on my windows machine, copy the resulting .jar file over to my raspberry pi 4 (running ubuntu 64-bit) and run the .jar file there. (I could even run the .jar file on my windows machine, which kind of puzzles me)

@akurasov
Copy link
Contributor

@toplinuxsir
we do not support cross compilation officially now. So you can try to build your app on the target system or try to use hack described by @Martinsbl

@akurasov akurasov removed the wait for reply Further information is requested label Nov 1, 2021
@akurasov akurasov added this to the 1.0 milestone Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop linux question Not a bug, but question or comment
Projects
None yet
Development

No branches or pull requests

4 participants