openage icon indicating copy to clipboard operation
openage copied to clipboard

Openage Startup Failure on macOS M4 Pro: No GUI

Open Skosulor opened this issue 9 months ago • 38 comments

Description:

Openage fails to run with make run and ./run main. No GUI applications is launched and the terminal receives thousands of lines of logs, a lot of the same.

Environment:

macOS Version: 15.3.1 Python Version: 3.13.3 Hardware: Apple Silicon M4 Pro Openage build: Debug mode with Homebrew LLVM llvm version 20.1.4 Qt version 6.9.0

Logs:

INFO Loading .nyan file: swgb_base/data/game_entity/generic/airbase/tech_level_4_upgrade.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/worker/worker.nyan
INFO Loading .nyan file: swgb_base/data/tech/generic/tech_level_2/tech_level_2.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/troop_center/tech_level_2_upgrade.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/shipyard/tech_level_2_upgrade.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/nova_proc_center/tech_level_2_upgrade.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/shaak/shaak.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/screwed_tree/screwed_tree.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/pine_tree/pine_tree.nyan

FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
INFO Loading .nyan file: swgb_base/data/game_entity/generic/wild_fambaa/wild_fambaa.nyan
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/palm_tree/palm_tree.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/oak_tree/oak_tree.nyan
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/nova_mine/nova_mine.nyan
INFO Loading .nyan file: swgb_base/data/game_entity/generic/mynock/mynock.nyan
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/leafless_tree/leafless_tree.nyan
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/jungle_tree/jungle_tree.nyan
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/faumpaset/faumpaset.nyan
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/ronto/ronto.nyan
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/massiff/massiff.nyan
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/dewback/dewback.nyan
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x134 [0x101b4d9b0]

handing over to the system...


FATAL: terminate has been called

uncaught exception

non-standard exception object

current stack:

Traceback (most recent call last):
  File ?, in _pthread_start+0x88 [0x1a005c2e4]
  File ?, in void* std::__1::__thread_proxy[abi:ne200100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, openage::engine::Engine::Engine(openage::engine::Engine::mode, openage::util::Path const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, openage::renderer::window_settings const&)::$_1>>(void*)+0x44 [0x101b4ba58]
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xc4 [0x101c3e990]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]
  File ?, in qtgui::GuiApplicationImpl::GuiApplicationImpl()+0x2c [0x101c982c4]
  File ?, in QGuiApplication::QGuiApplication(int&, char**, int)+0x54 [0x1033ec4b4]
  File ?, in QGuiApplicationPrivate::init()+0x4c [0x1033ec530]
  File ?, in QCoreApplicationPrivate::init()+0x2dc [0x1041110d0]
  File ?, in QGuiApplicationPrivate::createEventDispatcher()+0x24 [0x1033f1254]
  File ?, in QGuiApplicationPrivate::createPlatformIntegration()+0xb00 [0x1033eff00]
  File ?, in QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&)+0x7c [0x103419720]
  File ?, in QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&)+0x70 [0x1034197c0]
  File ?, in QCocoaIntegrationPlugin::create(QString const&, QList<QString> const&)+0x70 [0x127425940]
  File ?, in QCocoaIntegration::QCocoaIntegration(QList<QString> const&)+0x4c0 [0x12743a478]
  File ?, in -[NSApplication setMainMenu:]+0x174 [0x1a3cac3cc]
INFO Loading .nyan file: swgb_base/data/game_entity/generic/orray/orray.nyan
  File ?, in -[NSMenu _setMenuName:]+0x1d4 [0x1a3c97874]
  File ?, in -[NSCalendarDate initWithCoder:] [0x1a13c6198]
  File ?, in objc_exception_throw+0x1c0 [0x19fc9ee40]
  File ?, in __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) [0x1a0014c84]
  File ?, in __cxa_get_exception_ptr [0x1a0014cdc]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in std::terminate()+0x6c [0x1a00116b4]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]

Skosulor avatar May 13 '25 13:05 Skosulor

I think I've seen this soewhere else, but without a macOS machine this is difficult to investigate...

heinezen avatar May 14 '25 07:05 heinezen

I could try investigate it, however I do not really know where to start so if i get some pointers where to look, I'll start 🐛🔍

Skosulor avatar May 14 '25 07:05 Skosulor

Trying to run the game with lldb with a breakpoint at main. Stepping through the code I get to the point where PyImport_ImportModule("run") is called then I go through the process of choosing assets and such and after that the errors occur. I guess the lldb stepping stops since a python script takes over.

I'm trying to get to the point where Im just at where the exception is thrown but since the python script takes over I do not know how to do that.

Image

Skosulor avatar May 14 '25 09:05 Skosulor

Image

Okay I got a little further with lldb. I found that if i step over the mutex locking in openage::time::Clock::get_time() i get the crash but if I step in, I do not experience a crash.

Howerver when I "step in" I just go to the next line so it's hard to determine what is actually causing the crash.

EDIT:

This seems unrelated to the previous crash logs though, not sure why I get a crash here when debugging

Skosulor avatar May 14 '25 10:05 Skosulor

 File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0xf0 [0x101c3ec08]
  File ?, in openage::renderer::gui::GuiApplicationWithLogger::GuiApplicationWithLogger()+0x28 [0x101c94388]
  File ?, in qtgui::GuiApplicationImpl::get()+0x94 [0x101c9818c]

Looks like the cause is somewhere here. It probably happens when Qt initializes the window. Maybe take a look at init_graphics.

heinezen avatar May 14 '25 15:05 heinezen

Okay so I boiled it down to the GuiApplicationImpl

Image

Specifically the

	app{argc, &argv} {
	// Set locale back to POSIX for the decimal point parsing (see qcoreapplication.html#locale-settings).
	std::locale::global(std::locale().combine<std::numpunct<char>>(std::locale::classic()));

	qInfo() << "Compiled with Qt" << QT_VERSION_STR << "and run with Qt" << qVersion();
}

causes the crash. I can continue stepping through the code but since it is qt's library at that point I can only see assembly code

Skosulor avatar May 14 '25 18:05 Skosulor

Okay, so reading up a bit on QT and macos, it seems that the GUI thread must be run in the main thread of an application.

Stopping with a breakpoint at the code above it, I can see we are not in the main thread, but thread 6:

Image

Main thread is thread 1: Image

Unfortunately making a pull request to change which thread is run for QT is probably an undertaking too large for me.

Skosulor avatar May 14 '25 18:05 Skosulor

@Skosulor Can you pass me a link to the info where it says that Qt must be run in the main thread? That would be macOS specific behavior but I can't find anything about that online.

The threads are spawned in https://github.com/SFTtech/openage/blob/master/libopenage/engine/engine.cpp . The graphics are part of the presenter thread. You can probably play around with this file to get rid of the error if the thread assignment is the issue.

heinezen avatar May 16 '25 03:05 heinezen

Sorry I think I mixed things up a little. Cocoa needs to be run as main thread and from what i gather calls to the coca would also need to be in the main thread. However, the documentation is not very clear on this but from what i gather from other sources it points to that direction.

The error I'm getting seems to end up with an exception in the Coca and QT integration, hence the assumption.

Official doc for Apple(see under discussion): https://developer.apple.com/documentation/appkit/nsapplicationmain(::)

See here for some examples related to main thread, macos and ui: https://stackoverflow.com/questions/74893322/why-does-macos-ios-force-the-main-thread-to-be-the-ui-thread-and-are-there-an

The threads are spawned in https://github.com/SFTtech/openage/blob/master/libopenage/engine/engine.cpp . The graphics are part of the presenter thread. You can probably play around with this file to get rid of the error if the thread assignment is the issue.

That does not look too scary actually, I will see what I can do. Thanks!

Skosulor avatar May 16 '25 08:05 Skosulor

I tried swapping so that engine.loop is now run in a new thread while the presenter is run in the main thread.

	std::thread engine_thread([&engine]() {
		engine.loop();
	});

	if (run_mode == openage::engine::Engine::mode::FULL) {
		engine.presenter->run(win_settings);

		engine.presenter.reset();
		engine.running = false;
	}

	engine_thread.join();

Now I get a new error, related to rendering WorldStage

  File ?, in __Pyx_PyObject_FastCallDict(_object*, _object* const*, unsigned long, _object*)+0x128 [0x100e2bdf4]
  File ?, in _PyEval_EvalFrameDefault+0x2908 [0x1017c0ecc]
  File ?, in PyObject_Vectorcall+0x5c [0x10169ac60]
  File ?, in __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(_object*, _object* const*, unsigned long, _object*)+0xc4 [0x107fb2e34]
  File ?, in __pyx_pw_7openage_4main_8main_cpp_1run_game(_object*, _object* const*, long, _object*)+0x310 [0x107fb323c]
  File ?, in __pyx_pf_7openage_4main_8main_cpp_run_game(_object*, _object*, _object*)+0x123c [0x107fb46d0]
INFO [T2] Loading .nyan file: trial_base/data/tech/generic/loom/loom.nyan
  File ?, in openage::run_game(openage::main_arguments const&)+0x370 [0x1034f0584]
INFO [T2] Loading .nyan file: trial_base/data/game_entity/generic/tower/tower.nyan
  File ?, in openage::presenter::Presenter::run(openage::renderer::window_settings)+0xa4 [0x1038802f4]
  File ?, in openage::presenter::Presenter::init_graphics(openage::renderer::window_settings const&)+0x794 [0x103880c14]
  File ?, in std::__1::shared_ptr<openage::renderer::world::WorldRenderStage> std::__1::make_shared[abi:ne200100]<openage::renderer::world::WorldRenderStage, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, 0>(std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x5c [0x103882438]
  File ?, in std::__1::shared_ptr<openage::renderer::world::WorldRenderStage> std::__1::allocate_shared[abi:ne200100]<openage::renderer::world::WorldRenderStage, std::__1::allocator<openage::renderer::world::WorldRenderStage>, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, 0>(std::__1::allocator<openage::renderer::world::WorldRenderStage> const&, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x74 [0x10388ba4c]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::world::WorldRenderStage, std::__1::allocator<openage::renderer::world::WorldRenderStage>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, std::__1::allocator<openage::renderer::world::WorldRenderStage>, 0>(std::__1::allocator<openage::renderer::world::WorldRenderStage>, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x4c [0x10388bb8c]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::world::WorldRenderStage, std::__1::allocator<openage::renderer::world::WorldRenderStage>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, std::__1::allocator<openage::renderer::world::WorldRenderStage>, 0>(std::__1::allocator<openage::renderer::world::WorldRenderStage>, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x90 [0x10388bf24]
  File ?, in void std::__1::allocator_traits<std::__1::allocator<openage::renderer::world::WorldRenderStage>>::construct[abi:ne200100]<openage::renderer::world::WorldRenderStage, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, void, 0>(std::__1::allocator<openage::renderer::world::WorldRenderStage>&, openage::renderer::world::WorldRenderStage*, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x4c [0x10388c020]
  File ?, in openage::renderer::world::WorldRenderStage* std::__1::__construct_at[abi:ne200100]<openage::renderer::world::WorldRenderStage, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, openage::renderer::world::WorldRenderStage*>(openage::renderer::world::WorldRenderStage*, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x48 [0x10388c1c4]
  File ?, in openage::renderer::world::WorldRenderStage* std::__1::construct_at[abi:ne200100]<openage::renderer::world::WorldRenderStage, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const, openage::renderer::world::WorldRenderStage*>(openage::renderer::world::WorldRenderStage*, std::__1::shared_ptr<openage::renderer::Window>&, std::__1::shared_ptr<openage::renderer::Renderer>&, std::__1::shared_ptr<openage::renderer::camera::Camera>&, openage::util::Path&&, std::__1::shared_ptr<openage::renderer::resources::AssetManager>&, std::__1::shared_ptr<openage::time::Clock> const&&)+0x88 [0x10388c258]
  File ?, in openage::renderer::world::WorldRenderStage::WorldRenderStage(std::__1::shared_ptr<openage::renderer::Window> const&, std::__1::shared_ptr<openage::renderer::Renderer> const&, std::__1::shared_ptr<openage::renderer::camera::Camera> const&, openage::util::Path const&, std::__1::shared_ptr<openage::renderer::resources::AssetManager> const&, std::__1::shared_ptr<openage::time::Clock>)+0x4c [0x103a2d3dc]
  File ?, in openage::renderer::world::WorldRenderStage::WorldRenderStage(std::__1::shared_ptr<openage::renderer::Window> const&, std::__1::shared_ptr<openage::renderer::Renderer> const&, std::__1::shared_ptr<openage::renderer::camera::Camera> const&, openage::util::Path const&, std::__1::shared_ptr<openage::renderer::resources::AssetManager> const&, std::__1::shared_ptr<openage::time::Clock>)+0x190 [0x103a2c64c]
  File ?, in openage::renderer::world::WorldRenderStage::initialize_render_pass(unsigned long, unsigned long, openage::util::Path const&)+0x40c [0x103a2cc84]
  File ?, in openage::renderer::opengl::GlRenderer::add_shader(std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x34 [0x103a4191c]
  File ?, in std::__1::shared_ptr<openage::renderer::opengl::GlShaderProgram> std::__1::make_shared[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, 0>(std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x3c [0x103a41978]
  File ?, in std::__1::shared_ptr<openage::renderer::opengl::GlShaderProgram> std::__1::allocate_shared[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram> const&, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x54 [0x103a484d0]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x103a485f0]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x70 [0x103a48980]
  File ?, in void std::__1::allocator_traits<std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::construct[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, void, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>&, openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x103a48a5c]
  File ?, in openage::renderer::opengl::GlShaderProgram* std::__1::__construct_at[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, openage::renderer::opengl::GlShaderProgram*>(openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x28 [0x103a48be0]
  File ?, in openage::renderer::opengl::GlShaderProgram* std::__1::construct_at[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, openage::renderer::opengl::GlShaderProgram*>(openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x103a48c18]
INFO [T2] Loading .nyan file: trial_base/data/game_entity/generic/trebuchet/trebuchet.nyan
  File ?, in openage::renderer::opengl::GlShaderProgram::GlShaderProgram(std::__1::shared_ptr<openage::renderer::opengl::GlContext> const&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x103a53c28]
  File ?, in openage::renderer::opengl::GlShaderProgram::GlShaderProgram(std::__1::shared_ptr<openage::renderer::opengl::GlContext> const&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x27c [0x103a512fc]
  File ?, in glLinkProgramARB_Exec+0xb4 [0x1fd1a03f8]
  File ?, in gleLinkProgram+0x444 [0x1fd226410]
  File ?, in ShLink+0xd0 [0x1fd08481c]
  File ?, in glpLinkProgram+0x2718 [0x1fd06aaa8]
  File ?, in glpLLVMCGTopLevel+0x5b0 [0x1fd043968]
  File ?, in glpLLVMCGFunctionDefinition+0xae4 [0x1fd04db94]
  File ?, in glpLLVMCGNode+0x21c [0x1fd044cc0]
  File ?, in glpLLVMCGBlock+0x1bc [0x1fd04df80]
  File ?, in glpLLVMCGNode+0x24c [0x1fd044cf0]
  File ?, in glpLLVMCGSwitchStatement+0xb0 [0x1fd04e3a4]
  File ?, in _sigtramp+0x38 [0x1a0092de4]
  File ?, in std::terminate()+0x24 [0x1a001166c]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x278 [0x103638834]

It no longer seem related to Cocoa. It seems to occur when rendering the the world:

Image

More specifically the problem seem to occur when adding the shader for the world, the variable "srcs" seems empty to me?

Image

Im using the trial version assets.

Is there a potential issue that I changed the order of when engine.loop starts and the presenters starts?

Skosulor avatar May 16 '25 18:05 Skosulor

Ah I wasn't aware of that. Seems like this is baked into the OS... Then we'll have to find a solution. The reason the presenter is in a separate thread is that it's technically optional. The engine can run in headless mode because a game server wouldn't need UI or peripheral inputs.

I guess the easiest solution would be to put the current simulation loop code in Engine::loop() into a function, store that in Engine and threat it like the other function we pass to the threads spawned from the main thread. Then, if the engine is run in headless mode, we run the simulation function in the main thread. Otherwise, we run the presenter function. This should be macOS specific code though that is activated via preprocessor macro.

heinezen avatar May 16 '25 18:05 heinezen

I guess the easiest solution would be to put the current simulation loop code in Engine::loop() into a function, store that in Engine and threat it like the other function we pass to the threads spawned from the main thread. Then, if the engine is run in headless mode, we run the simulation function in the main thread. Otherwise, we run the presenter function. This should be macOS specific code though that is activated via preprocessor macro.

I'm not sure i follow a 100 %.

You mean that this->simulation->run(); + cleanup should be in a separate function and spawn it in a new thread in the constructor? Basically moving all of engine.loop into its own thread.

Then in main we either run the presenter or not depending on if we're in headless mode or not?

I think I kinda achieved that in my comment that I just posted (like a min before you, so you might have missed it) but In a hacky way to test if it solved the bug.

Skosulor avatar May 16 '25 19:05 Skosulor

Is there a potential issue that I changed the order of when engine.loop starts and the presenters starts?

Probably not, the presenter and simulation are pretty separate.

More specifically the problem seem to occur when adding the shader for the world, the variable "srcs" seems empty to me?

I don't think it's that and it shouldn't actually be empty. if you check https://github.com/SFTtech/openage/blob/86d05c44e93c537e53703db829e72b0b4d06041e/libopenage/renderer/stages/world/render_stage.cpp#L141

You see that it should always contain 2 items. Looks like the actual bug happens here based on your output https://github.com/SFTtech/openage/blob/86d05c44e93c537e53703db829e72b0b4d06041e/libopenage/renderer/opengl/shader_program.cpp#L81

heinezen avatar May 16 '25 19:05 heinezen

You mean that this->simulation->run(); + cleanup should be in a separate function...

Yes.

... and spawn it in a new thread in the constructor?

but I didn't mean that. What I meant was that Engine::loop() should run either the presenter loop function or the simulation loop function depending on the engine mode. i.e. the simulation loop is no longer hardcoded to the Engine::loop() function. This is necessary so that we have the option to do both of

main thread: simulation loop
    thread 1: time loop

(for headlees mode)

and

main thread: presenter loop
    thread 1: simulation loop
    thread 2: time loop

(for full mode)

on macOS.

I think I kinda achieved that in my comment that I just posted (like a min before you, so you might have missed it) but In a hacky way to test if it solved the bug.

Yeah I just saw that. The problem is that if you run in headless mode, the if-branch would be skipped and the engine would immediately exit :D That's why we have to make the solution a bit more flexible.

heinezen avatar May 16 '25 19:05 heinezen

but I didn't mean that. What I meant was that Engine::loop() should run either the presenter loop function or the simulation loop function depending on the engine mode. i.e. the simulation loop is no longer hardcoded to the Engine::loop() function. This is necessary so that we have the option to do both of

Ah I see!

Yeah I just saw that. The problem is that if you run in headless mode, the if-branch would be skipped and the engine would immediately exit :D That's why we have to make the solution a bit more flexible.

Yes, I'm fully on board that my solution is a hack :P

And you were right, it is at glLinkProgram(handle); it crashes, the handle have a value of 3 which makes sense I guess since it is the fourth time the constructor is called.

But I do not know where to go from this.

Skosulor avatar May 16 '25 19:05 Skosulor

@Skosulor I can think of a few things that might help us determine the exact error. You can run the binary with the --gl-debug flag. That should print OpenGL debug output in the terminal. If that doesn't produce anything useful, you can use glGetError right before glLinkProgram to check if OpenGL is in any error state before the linking starts.

I also found this forum post about glLinkProgram crashes on macOS, but I'm not sure if it's the same issue.

heinezen avatar May 16 '25 20:05 heinezen

You can run the binary with the --gl-debug flag. That should print OpenGL debug output in the terminal. If that doesn't produce anything useful, you can use glGetError right before glLinkProgram to check if OpenGL is in any error state before the linking starts.

Tried both, glGetError does not report any error and --gl-debug did not output anything more unfortunately.

I also found this forum post about glLinkProgram crashes on macOS, but I'm not sure if it's the same issue.

Hmm, I wouldn't know what to actually try to remove/change in the shaders, I'm not a game/graphics dev, I kinda just stumbled upon this project and it seemed fun. (Hopefully I'm not wasting too much of your time)

However I did try the demos and the result is the following:

0, 1, 5 and 6 does not crash nor produce any errors but no window is opened. I tried to find the code that create a window (should be the QT window.show() function?) but I could not find it.

Output from demo 5:

./run --window test --gl-debug --demo renderer.tests.renderer_demo 5
INFO Compiled with Qt 6.9.0 and run with Qt 6.9.0
WARN QOpenGLDebugLogger::startLogging(): object must be initialized before logging can start
INFO Created OpenGL context version 4.1
INFO Created Qt window with OpenGL context.
INFO Created OpenGL renderer
INFO Created new camera at position (12.2474, 10, 12.2474)
INFO Loading shaders...
INFO Created OpenGL shader program

Demos 2, 3 and 4 do crash with similar error as when running openage.

I will try to find out why the windows aren't being created and the reasons of the crash but I do not feel very confident it finding a solution, at least not to the crashes as my shader knowledge can be summarized on a post it :D

Skosulor avatar May 17 '25 12:05 Skosulor

Tried both, glGetError does not report any error and --gl-debug did not output anything more unfortunately.

I forgot to mention that you need to also run with the verbose flag -v to get any output from --gl-debug because it only prints in log level DEBUG. That reminds me to actually start mapping the Qt message severity levels to our own log messages properly...

should be the QT window.show() function?

It's a bit more granular because we call QWindow::create() and then set a bunch of flags before making the window visible. See the GlWindow constructor: https://github.com/SFTtech/openage/blob/86d05c44e93c537e53703db829e72b0b4d06041e/libopenage/renderer/opengl/window.cpp#L58-L85

heinezen avatar May 17 '25 12:05 heinezen

I found this quite interesting in gui_application_impl.cpp

void GuiApplicationImpl::processEvents() {
	assert(std::this_thread::get_id() == this->owner);
#ifndef __APPLE__
	this->app.processEvents();
#endif
}

Removing the ifndef guards enabled the window but looking at the commit it seems to come from a branch that was supposed to fix the macos configuration:

fd866798bc0aa7406b40093b65ce912a4721143c
Author:     Jonas Jelten <[email protected]>
AuthorDate: Sun Oct 23 01:27:25 2022 +0200
Commit:     heinezen <[email protected]>
CommitDate: Tue Feb 7 19:55:59 2023 +0100

Parent:     2c1722e1 gitignore: add clangd cache directory
Contained:  fix_macos_config_doc master

Skosulor avatar May 17 '25 13:05 Skosulor

Demos 2, 3 and 4 do crash with similar error as when running openage.

3 I can understand because it tests the WorldRenderStage that the normal engine also uses. Don't know what's the problem with 2 and 4 yet, but I guess it's good to know that not all shader linkings crash.

heinezen avatar May 17 '25 13:05 heinezen

Removing the ifndef guards enabled the window but looking at the commit it seems to come from a branch that was supposed to fix the macos configuration

I actually don't know why this line was excluded for macOS, but it might be a remainder of the switch from Qt5 to Qt6. I think it's safe to remove the ifndefs.

heinezen avatar May 17 '25 13:05 heinezen

Demos 2, 3 and 4 do crash with similar error as when running openage.

3 I can understand because it tests the WorldRenderStage that the normal engine also uses. Don't know what's the problem with 2 and 4 yet, but I guess it's good to know that not all shader linkings crash.

Running demo 2 with --gl-debug and -v

DEBUG initializing libopenage...
 DBG [py] C++ <-> Python interface has been initialized
INFO Compiled with Qt 6.9.0 and run with Qt 6.9.0
WARN QOpenGLDebugLogger::startLogging(): object must be initialized before logging can start
INFO Created OpenGL context version 4.1
 DBG Maximum supported texture size: 16384
 DBG Maximum supported texture units: 80
INFO Created Qt window with OpenGL context.
 DBG Created OpenGL framebuffer with display target
 DBG Created OpenGL render target for default framebuffer
INFO Created OpenGL renderer
INFO Loaded texture /Users/hell/repos/openage/assets/test/textures/test_texture.texture
INFO   imagefile: /Users/hell/repos/openage/assets/test/textures/test_texture.png
INFO   size:
INFO     width: 208
INFO     height: 160
INFO   pxformat:
INFO     data size: 133120 (208 x 160 x 4)
INFO     cbits: (currently unused)
INFO   subtex count: 18
INFO Loaded animation /Users/hell/repos/openage/assets/test/textures/test_animation.sprite
INFO   texture count: 1
INFO     texture 0: /Users/hell/repos/openage/assets/test/textures/test_texture.png
INFO   scalefactor: 1
INFO   layer count: 1
INFO     layer 0:
INFO       position: 20
INFO       time per frame: 0.125
INFO       replay delay: 0
INFO       angle count: 1
INFO       angle 0:
INFO         degree: 0
INFO         frame count: 18
INFO         mirrored: 0
INFO         frame 0:
INFO           texture idx: 0
INFO           subtexture idx: 0
INFO         frame 1:
INFO           texture idx: 0
INFO           subtexture idx: 1
INFO         frame 2:
INFO           texture idx: 0
INFO           subtexture idx: 2
INFO         frame 3:
INFO           texture idx: 0
INFO           subtexture idx: 3
INFO         frame 4:
INFO           texture idx: 0
INFO           subtexture idx: 4
INFO         frame 5:
INFO           texture idx: 0
INFO           subtexture idx: 5
INFO         frame 6:
INFO           texture idx: 0
INFO           subtexture idx: 6
INFO         frame 7:
INFO           texture idx: 0
INFO           subtexture idx: 7
INFO         frame 8:
INFO           texture idx: 0
INFO           subtexture idx: 8
INFO         frame 9:
INFO           texture idx: 0
INFO           subtexture idx: 9
INFO         frame 10:
INFO           texture idx: 0
INFO           subtexture idx: 10
INFO         frame 11:
INFO           texture idx: 0
INFO           subtexture idx: 11
INFO         frame 12:
INFO           texture idx: 0
INFO           subtexture idx: 12
INFO         frame 13:
INFO           texture idx: 0
INFO           subtexture idx: 13
INFO         frame 14:
INFO           texture idx: 0
INFO           subtexture idx: 14
INFO         frame 15:
INFO           texture idx: 0
INFO           subtexture idx: 15
INFO         frame 16:
INFO           texture idx: 0
INFO           subtexture idx: 16
INFO         frame 17:
INFO           texture idx: 0
INFO           subtexture idx: 17
INFO Loading shaders...

SIGSEGV

FATAL: terminate has been called

current stack:

Traceback (most recent call last):
  File ?, in main+0x198 [0x102a45924]
  File ?, in __Pyx_main(int, wchar_t**)+0x1a4 [0x102a45b3c]
  File ?, in PyImport_ImportModule+0x40 [0x1033da9e0]
  File ?, in PyImport_Import+0x14c [0x1033dabcc]
  File ?, in PyObject_CallFunction+0x38 [0x10326b5b0]
  File ?, in _PyObject_CallFunctionVa+0xa0 [0x10326b65c]
  File ?, in cfunction_vectorcall_FASTCALL_KEYWORDS+0x58 [0x1032c6a34]
  File ?, in builtin___import__+0xac [0x103387d3c]
  File ?, in PyImport_ImportModuleLevelObject+0xc44 [0x1033dbccc]
  File ?, in PyObject_CallMethodObjArgs+0x68 [0x10326c458]
  File ?, in object_vacall+0x10c [0x10326c5e0]
  File ?, in _PyEval_EvalFrameDefault+0x3b70 [0x103392134]
  File ?, in cfunction_vectorcall_O+0x68 [0x1032c6c58]
  File ?, in _imp_exec_builtin+0x10 [0x1033deed8]
  File ?, in PyModule_ExecDef+0xc0 [0x1032c8a5c]
  File ?, in __pyx_pymod_exec_run(_object*)+0xd20 [0x102a46aa4]
  File ?, in __Pyx_PyObject_FastCallDict(_object*, _object* const*, unsigned long, _object*)+0x128 [0x102a47df4]
  File ?, in _PyEval_EvalFrameDefault+0x2908 [0x103390ecc]
  File ?, in PyObject_Vectorcall+0x5c [0x10326ac60]
  File ?, in __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(_object*, _object* const*, unsigned long, _object*)+0xc4 [0x11f907898]
  File ?, in __pyx_pw_7openage_8renderer_5tests_1renderer_demo(_object*, _object* const*, long, _object*)+0x344 [0x11f907cd4]
  File ?, in __pyx_pf_7openage_8renderer_5tests_renderer_demo(_object*, _object*)+0x2e20 [0x11f90afac]
  File ?, in openage::renderer::tests::renderer_demo(int, openage::util::Path const&)+0xa4 [0x10550cee0]
  File ?, in openage::renderer::tests::renderer_demo_2(openage::util::Path const&)+0x2474 [0x1054de6f4]
  File ?, in openage::renderer::opengl::GlRenderer::add_shader(std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x34 [0x105611934]
  File ?, in std::__1::shared_ptr<openage::renderer::opengl::GlShaderProgram> std::__1::make_shared[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, 0>(std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x3c [0x105611990]
  File ?, in std::__1::shared_ptr<openage::renderer::opengl::GlShaderProgram> std::__1::allocate_shared[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram> const&, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x54 [0x1056184e8]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x105618608]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x70 [0x105618998]
  File ?, in void std::__1::allocator_traits<std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::construct[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, void, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>&, openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x105618a74]
  File ?, in openage::renderer::opengl::GlShaderProgram* std::__1::__construct_at[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, openage::renderer::opengl::GlShaderProgram*>(openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x28 [0x105618bf8]
  File ?, in openage::renderer::opengl::GlShaderProgram* std::__1::construct_at[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, openage::renderer::opengl::GlShaderProgram*>(openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x105618c30]
  File ?, in openage::renderer::opengl::GlShaderProgram::GlShaderProgram(std::__1::shared_ptr<openage::renderer::opengl::GlContext> const&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x105623c48]
  File ?, in openage::renderer::opengl::GlShaderProgram::GlShaderProgram(std::__1::shared_ptr<openage::renderer::opengl::GlContext> const&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x284 [0x10562131c]
  File ?, in glLinkProgramARB_Exec+0xb4 [0x1fd1a03f8]
  File ?, in gleLinkProgram+0x444 [0x1fd226410]
  File ?, in ShLink+0xd0 [0x1fd08481c]
  File ?, in glpLinkProgram+0x2718 [0x1fd06aaa8]
  File ?, in glpLLVMCGTopLevel+0x5b0 [0x1fd043968]
  File ?, in glpLLVMCGFunctionDefinition+0xae4 [0x1fd04db94]
  File ?, in glpLLVMCGNode+0x21c [0x1fd044cc0]
  File ?, in glpLLVMCGBlock+0x1bc [0x1fd04df80]
  File ?, in glpLLVMCGNode+0x24c [0x1fd044cf0]
  File ?, in glpLLVMCGSwitchStatement+0xb0 [0x1fd04e3a4]
  File ?, in _sigtramp+0x38 [0x1a0092de4]
  File ?, in std::terminate()+0x24 [0x1a001166c]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x278 [0x105208834]

handing over to the system...

libc++abi: terminating

Running demo 4 with --gl-debug and -v

DEBUG initializing libopenage...
 DBG [py] C++ <-> Python interface has been initialized
INFO Compiled with Qt 6.9.0 and run with Qt 6.9.0
WARN QOpenGLDebugLogger::startLogging(): object must be initialized before logging can start
INFO Created OpenGL context version 4.1
 DBG Maximum supported texture size: 16384
 DBG Maximum supported texture units: 80
INFO Created Qt window with OpenGL context.
 DBG Created OpenGL framebuffer with display target
 DBG Created OpenGL render target for default framebuffer
INFO Created OpenGL renderer
INFO Loading shaders...

SIGSEGV

FATAL: terminate has been called

current stack:

Traceback (most recent call last):
  File ?, in main+0x198 [0x10053d924]
  File ?, in __Pyx_main(int, wchar_t**)+0x1a4 [0x10053db3c]
  File ?, in PyImport_ImportModule+0x40 [0x100d629e0]
  File ?, in PyImport_Import+0x14c [0x100d62bcc]
  File ?, in PyObject_CallFunction+0x38 [0x100bf35b0]
  File ?, in _PyObject_CallFunctionVa+0xa0 [0x100bf365c]
  File ?, in cfunction_vectorcall_FASTCALL_KEYWORDS+0x58 [0x100c4ea34]
  File ?, in builtin___import__+0xac [0x100d0fd3c]
  File ?, in PyImport_ImportModuleLevelObject+0xc44 [0x100d63ccc]
  File ?, in PyObject_CallMethodObjArgs+0x68 [0x100bf4458]
  File ?, in object_vacall+0x10c [0x100bf45e0]
  File ?, in _PyEval_EvalFrameDefault+0x3b70 [0x100d1a134]
  File ?, in cfunction_vectorcall_O+0x68 [0x100c4ec58]
  File ?, in _imp_exec_builtin+0x10 [0x100d66ed8]
  File ?, in PyModule_ExecDef+0xc0 [0x100c50a5c]
  File ?, in __pyx_pymod_exec_run(_object*)+0xd20 [0x10053eaa4]
  File ?, in __Pyx_PyObject_FastCallDict(_object*, _object* const*, unsigned long, _object*)+0x128 [0x10053fdf4]
  File ?, in _PyEval_EvalFrameDefault+0x2908 [0x100d18ecc]
  File ?, in PyObject_Vectorcall+0x5c [0x100bf2c60]
  File ?, in __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(_object*, _object* const*, unsigned long, _object*)+0xc4 [0x11721b898]
  File ?, in __pyx_pw_7openage_8renderer_5tests_1renderer_demo(_object*, _object* const*, long, _object*)+0x344 [0x11721bcd4]
  File ?, in __pyx_pf_7openage_8renderer_5tests_renderer_demo(_object*, _object*)+0x2e20 [0x11721efac]
  File ?, in openage::renderer::tests::renderer_demo(int, openage::util::Path const&)+0xbc [0x102e94ef8]
  File ?, in openage::renderer::tests::renderer_demo_4(openage::util::Path const&)+0x658 [0x102e7654c]
  File ?, in openage::renderer::opengl::GlRenderer::add_shader(std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x34 [0x102f99934]
  File ?, in std::__1::shared_ptr<openage::renderer::opengl::GlShaderProgram> std::__1::make_shared[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, 0>(std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x3c [0x102f99990]
  File ?, in std::__1::shared_ptr<openage::renderer::opengl::GlShaderProgram> std::__1::allocate_shared[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram> const&, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x54 [0x102fa04e8]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x102fa0608]
  File ?, in std::__1::__shared_ptr_emplace<openage::renderer::opengl::GlShaderProgram, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::__shared_ptr_emplace[abi:ne200100]<std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x70 [0x102fa0998]
  File ?, in void std::__1::allocator_traits<std::__1::allocator<openage::renderer::opengl::GlShaderProgram>>::construct[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, void, 0>(std::__1::allocator<openage::renderer::opengl::GlShaderProgram>&, openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x102fa0a74]
  File ?, in openage::renderer::opengl::GlShaderProgram* std::__1::__construct_at[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, openage::renderer::opengl::GlShaderProgram*>(openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x28 [0x102fa0bf8]
  File ?, in openage::renderer::opengl::GlShaderProgram* std::__1::construct_at[abi:ne200100]<openage::renderer::opengl::GlShaderProgram, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&, openage::renderer::opengl::GlShaderProgram*>(openage::renderer::opengl::GlShaderProgram*, std::__1::shared_ptr<openage::renderer::opengl::GlContext>&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x102fa0c30]
  File ?, in openage::renderer::opengl::GlShaderProgram::GlShaderProgram(std::__1::shared_ptr<openage::renderer::opengl::GlContext> const&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x2c [0x102fabc48]
  File ?, in openage::renderer::opengl::GlShaderProgram::GlShaderProgram(std::__1::shared_ptr<openage::renderer::opengl::GlContext> const&, std::__1::vector<openage::renderer::resources::ShaderSource, std::__1::allocator<openage::renderer::resources::ShaderSource>> const&)+0x284 [0x102fa931c]
  File ?, in glLinkProgramARB_Exec+0xb4 [0x1fd1a03f8]
  File ?, in gleLinkProgram+0x444 [0x1fd226410]
  File ?, in ShLink+0xd0 [0x1fd08481c]
  File ?, in glpLinkProgram+0x2718 [0x1fd06aaa8]
  File ?, in glpLLVMCGTopLevel+0x5b0 [0x1fd043968]
  File ?, in glpLLVMCGFunctionDefinition+0xae4 [0x1fd04db94]
  File ?, in glpLLVMCGNode+0x21c [0x1fd044cc0]
  File ?, in glpLLVMCGBlock+0x1bc [0x1fd04df80]
  File ?, in glpLLVMCGNode+0x24c [0x1fd044cf0]
  File ?, in glpLLVMCGSwitchStatement+0xb0 [0x1fd04e3a4]
  File ?, in _sigtramp+0x38 [0x1a0092de4]
  File ?, in std::terminate()+0x24 [0x1a001166c]
  File ?, in std::__terminate(void (*)())+0x10 [0x1a0011710]
  File ?, in openage::error::terminate_handler()+0x278 [0x102b90834]

handing over to the system...

libc++abi: terminating

EDIT:

It seems that glLinkProgram(handle); is causes the crashes here as well

Skosulor avatar May 17 '25 13:05 Skosulor

We could check the link status with glGetShaderiv. Could you change the shader creation loop to

        std::vector<GlShader> shaders;
	for (auto const &src : srcs) {
		GlShader shader{context, src};

                GLint compiled = 0;
                glGetShaderiv(shader.get_handle(), GL_COMPILE_STATUS, &compiled);
                log::log(WARN << "Compile status: " << compiled);

		glAttachShader(handle, shader.get_handle());
		shaders.push_back(std::move(shader));
	}

That should give us info on whether the compilation was successful.

Edit: see https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGetShader.xhtml

heinezen avatar May 17 '25 14:05 heinezen

We could check the link status with glGetShaderiv. Could you change the shader creation loop to

    std::vector<GlShader> shaders;

for (auto const &src : srcs) { GlShader shader{context, src};

            GLint compiled = 0;
            glGetShaderiv(shader.get_handle(), GL_COMPILE_STATUS, &compiled);
            log::log(WARN << "Compile status: " << compiled);

  glAttachShader(handle, shader.get_handle());
  shaders.push_back(std::move(shader));

}

That should give us info on whether the compilation was successful.

Edit: see https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGetShader.xhtml

Result:

.
.
.
INFO           texture idx: 0
INFO           subtexture idx: 17
INFO Loading shaders...
WARN Compile status: 1
WARN Compile status: 1

SIGSEGV

FATAL: terminate has been called

current stack:

Traceback (most recent call last):
  File ?, in main+0x198 [0x1025cd924]
  File ?, in __Pyx_main(int, wchar_t**)+0x1a4 [0x1025cdb3c]
  File ?, in PyImport_ImportModule+0x40 [0x10315a9e0]

Assuming that GL_TRUE = 1 it seems the shader compiled successfully

Skosulor avatar May 17 '25 14:05 Skosulor

Could there be an issue with mac being stuck at opengl 4.1? It seems that quite a lot of features were added to 4.6

Skosulor avatar May 17 '25 15:05 Skosulor

Hmm then it's probably not the shader code. We use OpenGL 3.3 as the minimum, so 4.1 shouldn't be a problem.

heinezen avatar May 17 '25 15:05 heinezen

Which shader actually fails in demo 2? Is it obj_shader or display_shader? Can you also swap them around to see which one is crashing during the linking? That might answer which shader might be the problem.

heinezen avatar May 17 '25 15:05 heinezen

These lines could be the issue:

https://github.com/SFTtech/openage/blob/86d05c44e93c537e53703db829e72b0b4d06041e/assets/test/shaders/demo_2_obj.vert.glsl#L10-L11

Can you move these declarations into main() and see if that fixes the problem?

heinezen avatar May 17 '25 15:05 heinezen

Which shader actually fails in demo 2? Is it obj_shader or display_shader? Can you also swap them around to see which one is crashing during the linking? That might answer which shader might be the problem.

I did:

	auto display_shader = renderer->add_shader({display_vshader_src, display_fshader_src});
	log::log(WARN << "display_shader added");
	auto obj_shader = renderer->add_shader({obj_vshader_src, obj_fshader_src});
	log::log(WARN << "obj_shader added");

and got

INFO Loading shaders...                                                                                                                                                                                                                                                           
WARN Compile status: 1                                                                                                                   
WARN Compile status: 1                                                                                                                                                                                                                                                            
INFO Created OpenGL shader program                             
 DBG Uniforms:                                                                                                                                                                                                                                                                    
 DBG (0) color_texture: sampler2D                         
 DBG Vertex attributes:                              
 DBG (1) position: vec2                                                                                                                  
 DBG (0) uv: vec2                                                                                                                        
WARN display_shader added                                                                                                                
WARN Compile status: 1                                                                                                                   
WARN Compile status: 1                                                                                                                   
                                                                                                                                                                                                                                                                                  
SIGSEGV                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                  
FATAL: terminate has been called 

So it is the object shader is causing the crash

Skosulor avatar May 17 '25 17:05 Skosulor

These lines could be the issue:

openage/assets/test/shaders/demo_2_obj.vert.glsl

Lines 10 to 11 in 86d05c4 float width = offset_tile.y - offset_tile.x; float height = offset_tile.w - offset_tile.z;

Can you move these declarations into main() and see if that fixes the problem?

Tried it, same error unfortunately.

void main() {

	float width = offset_tile.y - offset_tile.x;
	float height = offset_tile.w - offset_tile.z;

	gl_Position = proj * mv * vec4(position, 0.0, 1.0);
    v_uv = vec2((uv.x * width) + offset_tile.x, (((1.0 - uv.y) * height) + offset_tile.z));
}

Skosulor avatar May 17 '25 17:05 Skosulor