question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SIGSEGV on macOS AARCH64 during GLFW error callback setup

See original GitHub issue

Environment

  • 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:closed
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
badlogiccommented, Mar 10, 2021

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 😃

1reaction
badlogiccommented, Mar 10, 2021

I’m an idiot and forgot -XstartOnFirstThread. Works as intended with the stdlib allocator.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault on M1 macOS Big Sur · Issue #864 - GitHub
I'm using FFI 1.14.2, Ruby 2.7.2, ARM64 build I think this the same issue ... I had this exact error when I installed...
Read more >
Segmentation fault macOS high sierra - support - GLFW
since upgrading to high sierra, every project that uses GLFW seems to segfault. I'm surprised not to find others with this problem
Read more >
Segmentation fault when including glad.h - Stack Overflow
I am following the GLFW guide to getting started ...
Read more >
0.9.0 Release Notes The Zig Programming Language
Generally, Zig 0.9.0 works much better than 0.8.x on macOS, due to major improvements in the Self-Hosted Linker, Versioned C Headers, and miscellaneous ......
Read more >
[SOLVED] JVM macOS issue - LWJGL Forum
So I'm trying to develop a LWJGL application in Scala and build it with sbt. ... private def init(): Unit = { //...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found