TheInfiniteKind/appbundler

OpenGL incompatibility

rsbfox opened this issue · 10 comments

Using http://legacy.lwjgl.org/ bindings. Project to run the gears demo.
gears.zip

Crash running bundled app.
crash.log

Command to run it normally.

java -Djava.library.path=native/macosx -cp "jar/*" org.lwjgl.test.opengl.Gears

I think the problem is not running on the main thread.

Looks like it's asking for -XstartOnFirstThread

I did try that. Then AWT never starts and window doesn't show up.

I'm currently using this many years old version that I think is from oracle and it works.

JavaAppLauncher.zip

Is this a Catalina-specific issue? See eg powervr-graphics/Native_SDK#46

This is on Catalina. I was saying it still works on the older javaapplauncher just not this fork for some reason when I build it.

I attached the native that works for me above.

It could be a difference caused by building against an older macOS SDK.
I saw this comment in another project.

https://github.com/TurboVNC/turbovnc/blob/master/unix/vncviewer/CMakeLists.txt#L19

We have a very similar problem in the Arduino IDE, we rebuild appbundler with the latest MacOSX SDK, but suddenly the Arduino IDE started crashing on macs with external monitor.

See arduino/Arduino#10234

We cannot use the old appbundler because is built using a very old MacOSX SDK and it will not pass notarization, so we are basically stuck... If anyone is aware of a solution for this problem please let us know!

Open launcher in hex editor.

Look for 24000000 10000000 00070A00 00070A00
Change 7s to 9s.
image
image

Confirm change with otool. See if it passes notarization.

Look for 24000000 10000000 00070A00 00070A00
Change 7s to 9s.

@rsbfox I was almost tempted to do it 😈

of course I didn't, if Apple will ever notice it I guess they may revoke our developer certificates and all previous notarizations we did and we cannot afford that risk.

BTW your suggestion made me think that I don't need the very latest SDK, because the requirement is >=10.9... maybe building on SDK 10.9 will not trigger the bug and will allow to pass notarization without cheating and... you know what... it worked!

The solution may not be immediatedly obvious but it's simply: build on SDK 10.9 :-)

arduino/appbundler@9db7000

So, what can I say, thank you @rsbfox for you indirect help I owe you a beer! 🍺

Building against SDK 10.9 does not work for the current version, as it uses NSEventModifierFlagNumericPad which is only available in macOS 10.12+.

But building against SDK 10.12 works.

I had an AppBundler binary built against SDK 10.14 which worked well over the last year, but my newest version built against SDK 10.15 sometimes crashed with the mentioned error message (Crashed Thread: Java: Java2D Queue Flusher. -[NSOpenGLContext setView:] must be called from the main thread.)

I have now built the binary again for me pointing to SDK 10.12 hoping to fix the issue.

Following the link sent from @rsbfox I've seen also this comment on TurboVNC project TurboVNC/turbovnc#186 (comment) where it seems the weird behaviour happens using SDK 10.11+. @mrieser let us know if SDK 10.12 fixes the issue for you, so we have more data to compare...

Running into this one (again) because building against the 10.9 SDK isn't possible (afaict) for Apple Silicon. I've been able to get appbundler to build for aarch64 but hitting an immediate crash with OpenGL apps, presumably due to the underlying problem (the context being used for OpenGL).

Also getting confirmation that it's not simply a matter of adding -XstartOnFirstThread, though seems highly likely that it's at least part of the solution.