Hello :wave: I'm trying to package and distribute ...
# compose-desktop
m
Hello 👋 I'm trying to package and distribute a dmg for my compose desktop app. I followed the tutorial in the readme and even what's described in this issue. The app is badly crashing at startup with a sigtrap. It's even crashing if I run the app with
runDistributable
(
finished with non-zero exit value 133
). I noticed that the crash will stop if I comment out the
signing
block in my gradle configuration. I've tried every jdk from 15 to 19 (zulu). I'm using Kotlin 1.8.10, compose 1.3.1. Anybody has any clue about what I'm missing? Stacktrace and gradle config is in the thread 🧵
Apple stacktrace:
Copy code
Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x00000001aff22f58

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [81123]

Thread 0::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x1afee2050 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1afef411c mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1afeeac24 mach_msg_overwrite + 452
3   libsystem_kernel.dylib        	       0x1afee23cc mach_msg + 24
4   CoreFoundation                	       0x1b0001bb0 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x1b000049c __CFRunLoopRun + 1232
6   CoreFoundation                	       0x1affff878 CFRunLoopRunSpecific + 612
7   libjli.dylib                  	       0x1010cb5c4 CreateExecutionEnvironment + 400
8   libjli.dylib                  	       0x1010c79c0 JLI_Launch + 1212
9   FeedFlow                      	       0x100fcab00 jvmLauncherStartJvm + 328
10  FeedFlow                      	       0x100fc9224 Jvm::launch() + 728
11  FeedFlow                      	       0x100fcc058 (anonymous namespace)::initJvmLauncher() + 1264
12  FeedFlow                      	       0x100fcf7a0 app::launch(std::nothrow_t const&, void (*)(), LogAppender*) + 212
13  dyld                          	       0x1afbf7e50 start + 2544

Thread 1:
0   libsystem_kernel.dylib        	       0x1afee3e0c __ulock_wait + 8
1   libsystem_pthread.dylib       	       0x1aff24394 _pthread_join + 444
2   libjli.dylib                  	       0x1010cbc9c CallJavaMainInNewThread + 184
3   libjli.dylib                  	       0x1010cab4c ContinueInNewThread + 144
4   libjli.dylib                  	       0x1010c8a94 JLI_Launch + 5520
5   FeedFlow                      	       0x100fcab00 jvmLauncherStartJvm + 328
6   FeedFlow                      	       0x100fc9224 Jvm::launch() + 728
7   FeedFlow                      	       0x100fcf7a0 app::launch(std::nothrow_t const&, void (*)(), LogAppender*) + 212
8   libjli.dylib                  	       0x1010cc55c apple_main + 88
9   libsystem_pthread.dylib       	       0x1aff2206c _pthread_start + 148
10  libsystem_pthread.dylib       	       0x1aff1ce2c thread_start + 8

Thread 2 Crashed:
0   libsystem_pthread.dylib       	       0x1aff22f58 pthread_jit_write_protect_np + 516
1   libjvm.dylib                  	       0x102beee7c Threads::create_vm(JavaVMInitArgs*, bool*) + 136
2   libjvm.dylib                  	       0x102740f68 JNI_CreateJavaVM + 120
3   libjli.dylib                  	       0x1010c90a8 JavaMain + 260
4   libjli.dylib                  	       0x1010cbce4 ThreadJavaMain + 12
5   libsystem_pthread.dylib       	       0x1aff2206c _pthread_start + 148
6   libsystem_pthread.dylib       	       0x1aff1ce2c thread_start + 8
Gradle setup
Copy code
nativeDistributions {

    modules("java.instrument", "java.sql", "jdk.unsupported")

    targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)

    packageName = ""
    packageVersion = "1.0.0"

    val iconsRoot = project.file("src/jvmMain/resources/icons/")

    macOS {
        iconFile.set(iconsRoot.resolve("icon.icns"))

        bundleID = "<http://com.acme.app|com.acme.app>"

        signing {
            sign.set(true)
            identity.set("Marco Gomiero")
        }

        notarization {
            appleID.set("<mail>")
            password.set("<pwd>")
        }
    }
    windows {
        iconFile.set(project.file("icon.ico"))
    }
    linux {
        iconFile.set(project.file("icon.png"))
    }
}
Seems like some memory protection during the initialization of the JVM. But no idea
Copy code
Thread 2 Crashed:
0   libsystem_pthread.dylib       	       0x1aff22f58 pthread_jit_write_protect_np + 516
1   libjvm.dylib                  	       0x102beee7c Threads::create_vm(JavaVMInitArgs*, bool*) + 136
2   libjvm.dylib                  	       0x102740f68 JNI_CreateJavaVM + 120
3   libjli.dylib                  	       0x1010c90a8 JavaMain + 260
4   libjli.dylib                  	       0x1010cbce4 ThreadJavaMain + 12
5   libsystem_pthread.dylib       	       0x1aff2206c _pthread_start + 148
6   libsystem_pthread.dylib       	       0x1aff1ce2c thread_start + 8
a
@Marco Gomiero do you use macOS 13.1+? Can you try to add entitlements like this: https://github.com/JetBrains/compose-multiplatform/issues/2887#issuecomment-1473702563
m
Oh yes it’s working now 😍 Thanks a lot!
a
Cool! I'm going to add these entitlements by default, so in future releases you could avoid doing extra configuration
m
Lovely! Thanks!