SIGSEGV on macOS AARCH64 during GLFW error callback setup
See original GitHub issueEnvironment
- LWJGL version:
3.3.0
- LWJGL build #:
7
- Java version:
15
- Platform:
macOS
- Module:
core
Description
Consider this mavenized HelloWorld
app, depending on native-macos-arm64
LWJGL3 natives. When ran on macOS Big Sur, on a MacBook Pro Apple Silicon, using Azul JDK 15 AARCH64 (so it runs natively), LWJGL3 crashes when setting up the GLFW binding, namely the error callback via libffi. See this crash log for the full stack trace and system info.
Notably, before the callbacks are setup, the jemalloc binding is initialized, printing the following info:
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
I haven’t looked into the sources yet, but I guess something in LWJGL or libffi makes assumption about the standard page size, usually assumed to be 4k. However, that is not true on macOS AARCH64. The page size needs to be polled from the OS.
Further more, if libffi or LWJGL setup trampolines via dynamically allocated executable memory on AARCH64, that memory has to be page aligned as well.
I’m unsure if you have the hardware to test things on. I’d be happy to help if instructed on how to do that.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
I can run the HelloWorld sample natively on M1 with this binary. The fixed 16Kb page size is likely to work the next few M1 iterations 😃
I’m an idiot and forgot
-XstartOnFirstThread
. Works as intended with the stdlib allocator.