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

Targeting Desktop MacOS using JVM-based libraries (Like VLCJ) crash when called at runtime with permissions error, runs fine in the IDE #4712

Open
realityexpander opened this issue Apr 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working desktop

Comments

@realityexpander
Copy link

realityexpander commented Apr 26, 2024

Describe the bug

When attempting to build a MacOS Desktop target using the VLCJ library (per the example in the experimental folder), running it locally works as expected.

After creating all the proper settings and configurations for a signed App acceptance per Apple's instructions and successfully uploading of a build (which runs fine locally), and is accepted by Apple. The App is then made available in TestFlight for users to download.

Upon a user downloading an launching the App, everything works fine until accessing the VLCJ videoplayer, which causes a crash. The library is successfully loaded, but something else is causing a violation (permissions? library not signed?):

I am able to get any regular Kotlin-native library (for KMM/KMP) work fine on all platforms. It's just these libaries that link back to JVM somewhere... like VLCJ or WebView.

Please forgive my lack of proper terminology, I am an Android/iOS developer, MacOS desktop is totally new to me.

Affected platforms

  • Desktop (macOS) only

Versions

  • Kotlin version*: 1.9.23
  • Compose Multiplatform version*: 1.6.6
  • OS version(s)* (required for Desktop and iOS issues): 14.4.1 (23E224)
  • OS architecture (x86 or arm64): arm64
  • Device (model or simulator for iOS issues): Any
  • JDK (for desktop issues): Corretto 18.0.2, Corretto 20.0.1, Temurin 21.0.2, Temurin 20.0.2

To Reproduce
Steps and/or the code snippet to reproduce the behavior:

Reference project and commit:
https://github.com/realityexpander/CloudCoverUSA2/blob/37feae3c18c55591331c2981eb149b2ab3e84dd9/composeApp/src/commonMain/kotlin/App.kt#L471

Include a JVM library (like this:)

// build.graadle.kts (:composeApp)
desktopMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(compose.desktop.common)
            implementation(libs.ktor.client.java)
            implementation(libs.coil.network.ktor)

            // for vlcj
            implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.8.0")
            implementation("uk.co.caprica:vlcj:4.8.2")
        }

Running locally (using composeDesktop:run, composeDesktop:runRelease) works great. composeDesktop:runDistributable and composeDesktop:runReleaseDistributable have never worked for me.

Target MacOS desktop using the packagePkg task. Everything signs properly and upload is accepted by Apple.
Upon downloading and accessing the VLCJ component causes a crash at runtime, and these windows pop-up:

Screenshot 2024-04-26 at 3 27 46 PM Screenshot 2024-04-26 at 3 27 21 PM Screenshot 2024-04-26 at 3 27 53 PM

Expected behavior
I expect the same behavior when running locally, ie: the VLCJ library has full functionality and does not crash at runtime after distribution via Apple TestFlight or production.

Screenshots
Included above

Additional context
Here's the log from the Cloud Cover USA 2 > Data > Library > Logs > Cloud Cover USA 2_debug.log

[0421/134207.769659:FATAL:mach_port_rendezvous.cc(148)] Check failed: kr == KERN_SUCCESS. bootstrap_check_in org.jcef.jcef.helper.MachPortRendezvousServer.70484: Permission denied (1100)
[0421/134229.391927:FATAL:mach_port_rendezvous.cc(148)] Check failed: kr == KERN_SUCCESS. bootstrap_check_in org.jcef.jcef.helper.MachPortRendezvousServer.70557: Permission denied (1100)
[0421/135312.446145:FATAL:mach_port_rendezvous.cc(148)] Check failed: kr == KERN_SUCCESS. bootstrap_check_in org.jcef.jcef.helper.MachPortRendezvousServer.71147: Permission denied (1100)
[0421/140441.134448:FATAL:mach_port_rendezvous.cc(148)] Check failed: kr == KERN_SUCCESS. bootstrap_check_in org.jcef.jcef.helper.MachPortRendezvousServer.72941: Permission denied (1100)
[0421/162047.433538:FATAL:mach_port_rendezvous.cc(148)] Check failed: kr == KERN_SUCCESS. bootstrap_check_in org.jcef.jcef.helper.MachPortRendezvousServer.85663: Permission denied (1100)

here's the project I'm using:
https://github.com/realityexpander/CloudCoverUSA2/blob/37feae3c18c55591331c2981eb149b2ab3e84dd9/composeApp/src/commonMain/kotlin/App.kt#L471

PS: I targeted iOS and use KMM/KMP libraries for video and it works on Desktop for arm64 macs with no problems.

@realityexpander realityexpander added bug Something isn't working submitted labels Apr 26, 2024
@realityexpander realityexpander changed the title Targeting Desktop MacOS using JVM-based libraries crash when called at runtime with permissions error Targeting Desktop MacOS using JVM-based libraries (Like VLCJ) crash when called at runtime with permissions error, runs fine in the IDE Apr 26, 2024
@Schahen Schahen added desktop and removed submitted labels Apr 29, 2024
@Schahen Schahen assigned igordmn and unassigned MatkovIvan Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working desktop
Projects
None yet
Development

No branches or pull requests

4 participants