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

OpenGL incompatibility #70

Open
rsbfox opened this issue Apr 18, 2020 · 10 comments
Open

OpenGL incompatibility #70

rsbfox opened this issue Apr 18, 2020 · 10 comments

Comments

@rsbfox
Copy link

rsbfox commented Apr 18, 2020

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.

@twogee
Copy link

twogee commented Apr 18, 2020

Looks like it's asking for -XstartOnFirstThread

@rsbfox
Copy link
Author

rsbfox commented Apr 18, 2020

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

@twogee
Copy link

twogee commented Apr 19, 2020

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

@rsbfox
Copy link
Author

rsbfox commented Apr 19, 2020

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

@cmaglie
Copy link

cmaglie commented Jun 10, 2020

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!

@rsbfox
Copy link
Author

rsbfox commented Jun 10, 2020

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.

@cmaglie
Copy link

cmaglie commented Jun 11, 2020

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! 🍺

@mrieser
Copy link

mrieser commented Jul 15, 2020

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.

@cmaglie
Copy link

cmaglie commented Jul 15, 2020

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...

@benfry
Copy link

benfry commented Jan 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants