libgdx / packr

Packages your JAR, assets and a JVM for distribution on Windows, Linux and Mac OS X
Apache License 2.0
2.57k stars 171 forks source link

LWJGL3 crashes on OSX #218

Closed KanedaFr closed 2 years ago

KanedaFr commented 2 years ago

Because I thought my previous issue (#217) would be resolved using LWJGL3, I migrated my desktop app. While it works like expected from Android Studio, if I packer it, it crashes on OSX

This is --cli --verbose -- output :

Passing VM options ...
isZgcSupported()=1, hasJsonValue(jsonRoot, "useZgcIfSupportedOs", sajson::TYPE_TRUE)=0
  # -Xmx1G
Passing VM options:
  -Xmx1G
Creating Java VM ...
Passing command line arguments ...
Loading JAR file ...
Adding 1 classpaths ...
  # desktop-1.0.jar
Invoking static com.willna.twinbee.desktop.DesktopLauncher.main() function ...
Checked for an exception from the main method, exceptionOccurred=1
Calling java.lang.Thread#dispatchUncaughtException(Throwable) on main thread
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/lwjgl/system/Callback.<clinit>()V @167: invokestatic
  Reason:
    Type 'org/lwjgl/PointerBuffer' (current frame, stack[1]) is not assignable to 'org/lwjgl/system/CustomBuffer'
  Current Frame:
    bci: @167
    flags: { }
    locals: { 'org/lwjgl/system/MemoryStack', null, '[Ljava/lang/Class;', '[Ljava/lang/reflect/Method;', 'org/lwjgl/PointerBuffer' }
    stack: { '[Ljava/lang/reflect/Method;', 'org/lwjgl/PointerBuffer' }
  Bytecode:
    0000000: b200 3803 b800 39b6 003a c000 3bb6 003c
    0000010: b300 19b8 003d 4b01 4c04 bd00 3e59 03b2
    0000020: 003f 534d 100a bd00 4059 0312 4112 422c
    0000030: b600 4353 5904 1244 1242 2cb6 0043 5359
    0000040: 0512 4512 422c b600 4353 5906 1246 1242
    0000050: 2cb6 0043 5359 0712 4712 422c b600 4353
    0000060: 5908 1248 1242 2cb6 0043 5359 1006 1249
    0000070: 1242 2cb6 0043 5359 1007 124a 1242 2cb6
    0000080: 0043 5359 1008 124b 1242 2cb6 0043 5359
    0000090: 1009 124c 1242 2cb6 0043 534e 2a2d beb6
    00000a0: 004d 3a04 2d19 04b8 004e b800 4f58 1904
    00000b0: b600 50b3 001e 1904 b600 50b3 001f 1904
    00000c0: b600 50b3 0020 1904 b600 50b3 0021 1904
    00000d0: b600 50b3 0022 1904 b600 50b3 0023 1904
    00000e0: b600 50b3 0024 1904 b600 50b3 0026 1904
    00000f0: b600 50b3 0027 1904 b600 50b3 0025 2ac6
    0000100: 0046 2bc6 0013 2ab6 0051 a700 3b4d 2b2c
    0000110: b600 53a7 0032 2ab6 0051 a700 2b4d 2c4c
    0000120: 2cbf 3a05 2ac6 001d 2bc6 0015 2ab6 0051
    0000130: a700 123a 062b 1906 b600 53a7 0007 2ab6
    0000140: 0051 1905 bfa7 000f 4bbb 0016 5912 552a
    0000150: b700 56bf b800 5757 b1                 
  Exception Handler Table:
    bci [262, 266] => handler: 269
    bci [25, 254] => handler: 285
    bci [25, 254] => handler: 290
    bci [300, 304] => handler: 307
    bci [285, 292] => handler: 290
    bci [19, 325] => handler: 328
  Stackmap Table:
    full_frame(@269,{Object[#164],Object[#165]},{Object[#165]})
    same_frame(@278)
    same_locals_1_stack_item_frame(@285,Object[#165])
    same_locals_1_stack_item_frame(@290,Object[#165])
    full_frame(@307,{Object[#164],Object[#165],Top,Top,Top,Object[#165]},{Object[#165]})
    same_frame(@318)
    same_frame(@322)
    full_frame(@325,{},{})
    same_locals_1_stack_item_frame(@328,Object[#166])
    same_frame(@340)

    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.initializeGlfw(Lwjgl3Application.java:81)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:91)
    at com.willna.twinbee.desktop.DesktopLauncher.main(DesktopLauncher.java:12)
Destroyed Java VM ...

then I have to kill app and terminal

karlsabo commented 2 years ago

Are you able to run desktop-1.0.jar without using packr? E.g., java -cp desktop-1.0.jar com.willna.twinbee.desktop.DesktopLauncher.

The exception Type 'org/lwjgl/PointerBuffer' (current frame, stack[1]) is not assignable to 'org/lwjgl/system/CustomBuffer' sounds like it might be a classpath issue.

KanedaFr commented 2 years ago

hi, you're right, I have the same error while using commandLine. same thing if I call the version built by AndroidStudio at libs/desktop-1.0.jar. it only works if I launch it using the Run/Debug configuration on Android Studio I wonder what's happening... I'll try to fix this outside of packr first and l'll let you know

KanedaFr commented 2 years ago

It's a libgdx related issue, sorry about this.

For anyone with this problem -> https://github.com/libgdx/libgdx/issues/4777

I'll let you close the issue, thanks for your help

crykn commented 2 years ago

Since this is a known issue with libGDX, I'll close this.