afwbkbc / glsmac

Unofficial open-source OpenGL/SDL2 reimplementation of Sid Meier's Alpha Centauri ( + Alien Crossfire )
GNU Affero General Public License v3.0
425 stars 12 forks source link

Crash on MacOS build #25

Closed e-rook closed 8 months ago

e-rook commented 11 months ago

Hello,

Today I have managed to build glsmac on MacOS platform and during execution attempt I have received the following crash. I have rebuilt it with debug information and seems it is problem with creating menu from non-main thread. I am not familiar with SDL but will try to google around it a little - if you have any ideas I can do some more work around it.

Creating directory: /Users/pgawron/.local/share/glsmac/debug/ Starting thread Starting thread Starting thread Thread started, entering main loop Starting thread Initializing SDL2 State set to 3922600251:3009507548:875514653:2432736781 Thread started, entering main loop Initializing SDL2 2023-12-04 11:10:38.624 GLSMAC[23477:6862187] *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:772 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse warning: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.' *** First throw call stack: ( 0 CoreFoundation 0x00007ff819582fa6 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff819078231 objc_exception_throw + 48 2 Foundation 0x00007ff81a56b106 -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x00007ff81caf8428 -[NSMenu _setMenuName:] + 978 4 AppKit 0x00007ff81cb0e6e7 -[NSApplication setMainMenu:] + 427 5 GLSMAC 0x0000000102e39c65 CreateApplicationMenus + 149 6 GLSMAC 0x0000000102e3988f Cocoa_RegisterApp + 319 7 GLSMAC 0x0000000102e4452e Cocoa_CreateDevice + 30 8 GLSMAC 0x0000000102d2e9aa SDL_VideoInit_REAL + 650 9 GLSMAC 0x0000000102c234a9 SDL_VideoInit + 25 10 GLSMAC 0x00000001027bcffb _ZN8graphics6opengl6OpenGL5StartEv + 91 11 GLSMAC 0x0000000102622e5e _ZN4base6Thread3RunEv + 446 12 GLSMAC 0x0000000102625239 _ZNSt3__18__invokeB7v160006IMN4base6ThreadEFvvEPS2_JEvEEDTcldsdeclsr3stdE7declvalIT0_EEclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT1_EEEEOS7_OS6_DpOS8_ + 105 13 GLSMAC 0x000000010262517e _ZNSt3__116__thread_executeB7v160006INS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEMN4base6ThreadEFvvEJPS7_EJLm2EEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE + 14 GLSMAC 0x0000000102624b12 _ZNSt3__114__thread_proxyB7v160006INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN4base6ThreadEFvvEPS8_EEEEEPvSD_ + 98 15 libsystem_pthread.dylib 0x00007ff819435202 _pthread_start + 99 16 libsystem_pthread.dylib 0x00007ff819430bab thread_start + 15 )
e-rook commented 11 months ago

Problems is in OpenGL.cpp, this call is failing. SDL_VideoInit( NULL ); After changing driver to (blind shot) 'x11' problem moves to SDL_CreateWindow

afwbkbc commented 9 months ago

I'll see what I can do but I don't have any Apple hardware as of now, hopefully somebody who has it will join in and fix.

afwbkbc commented 8 months ago

Just found this:

With the release of macOS Mojave 10.14, Apple discontinued official support for OpenGL (core), and a Metal support GPU is a system requirement.

Apple's support of Vulkan is also very questionable and we can't rely on it long-term. So unless somebody (not me) wants to step in and code Metal renderer for GLSMAC (separate renderer just for apple!), it's just not happening. Good reason to stop being apple slave and buy a proper computer :)

Closing because it's not a bug.