Opened 2 years ago

Closed 2 years ago

#6395 closed defect (fixed)

[macOS] Crash right from the start

Reported by: Langbart Owned by: Vladislav Belov
Priority: Should Have Milestone: Alpha 26
Component: Core engine Keywords:
Cc: Patch: D4370

Description

crash

Testing the latest git version. I get a zsh: segmentation fault right from the start. See image below for more clarity.

lldb

pyrogenesis was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 64389 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001010b0660 pyrogenesis`::mozalloc_abort(msg=<unavailable>) at mozalloc_abort.cpp:33:3 [opt]
   30  	#ifdef MOZ_WIDGET_ANDROID
   31  	  abortThroughJava(msg);
   32  	#endif
-> 33  	  MOZ_CRASH();
   34  	}
   35  	
   36  	#ifdef MOZ_WIDGET_ANDROID
Target 0: (pyrogenesis) stopped.
(lldb) bt
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000001010b0660 pyrogenesis`::mozalloc_abort(msg=<unavailable>) at mozalloc_abort.cpp:33:3 [opt]
    frame #1: 0x0000000101ab6e6d pyrogenesis`::abort() at mozalloc_abort.cpp:82:3 [opt]
    frame #2: 0x00000001005089f6 pyrogenesis`sys_display_error(text=<unavailable>, flags=6) at unix.cpp:268:4 [opt]
    frame #3: 0x00000001004e1dd3 pyrogenesis`debug_DisplayError(wchar_t const*, unsigned long, void*, wchar_t const*, wchar_t const*, int, char const*, long volatile*) [inlined] CallDisplayError(text=L"Assertion failed: \"exts\"\r\nLocation: ogl.cpp:480 (ogl_Init)\r\n\r\nCall stack:\r\n\r\n(error while dumping stack: Function not supported)\r\nerrno = 2 (Error during IO)\r\nOS error = ?\r\n", flags=6) at debug.cpp:374:8 [opt]
    frame #4: 0x00000001004e1db6 pyrogenesis`debug_DisplayError(description=L"Assertion failed: \"exts\"", flags=6, context=0x00007ffeefbfd580, lastFuncToSkip=<unavailable>, pathname=L"../../../source/lib/ogl.cpp", line=480, func=<unavailable>, suppress=0x0000000103ad5c68) at debug.cpp:460 [opt]
    frame #5: 0x00000001004e263e pyrogenesis`debug_OnAssertionFailure(expr=<unavailable>, suppress=0x0000000103ad5c68, file=<unavailable>, line=<unavailable>, func=<unavailable>) at debug.cpp:547:9 [opt]
    frame #6: 0x00000001004f9942 pyrogenesis`ogl_Init() at ogl.cpp:480:2 [opt]
    frame #7: 0x000000010028e37a pyrogenesis`CVideoMode::InitSDL(this=0x0000000103ae0a08) at VideoMode.cpp:459:2 [opt]
    frame #8: 0x000000010020c1c1 pyrogenesis`InitGraphics(args=0x00007ffeefbff680, flags=0, installedMods=size=0) at GameSetup.cpp:890:20 [opt]
    frame #9: 0x0000000100005dd7 pyrogenesis`RunGameOrAtlas(argc=<unavailable>, argv=<unavailable>) at main.cpp:685:4 [opt]
    frame #10: 0x00000001000044f6 pyrogenesis`main(argc=1, argv=0x00007ffeefbff9c0) at main.cpp:742:2 [opt]
    frame #11: 0x00007fff718b6cc9 libdyld.dylib`start + 1
(lldb) 

bisect

Doing git bisect, the problem starts with changeset [26031]. See image below for more clarity.

Attachments (3)

bisect.jpg (131.8 KB ) - added by Langbart 2 years ago.
crash.jpg (96.0 KB ) - added by Langbart 2 years ago.
logs.zip (11.9 KB ) - added by Langbart 2 years ago.

Download all attachments as: .zip

Change History (14)

by Langbart, 2 years ago

Attachment: bisect.jpg added

by Langbart, 2 years ago

Attachment: crash.jpg added

comment:1 by Vladislav Belov, 2 years ago

Could you attach logs/console output?

comment:2 by Langbart, 2 years ago

Attaching a zip file - logs.zip, which contains

  • crashlog.txt,
  • mainlog.html,
  • interestinglog.html and
  • the terminal_output.txt while doing lldb.

by Langbart, 2 years ago

Attachment: logs.zip added

comment:3 by nwtour, 2 years ago

https://www.khronos.org/opengl/wiki/OpenGL_Context#OpenGL_3.2_and_Profiles

Platform Issue (MacOSX): When MacOSX 10.7 introduced support for OpenGL beyond 2.1, they also introduced the core/compatibility dichotomy. However, they did not introduce support for the compatibility profile itself. Instead, MacOSX gives you a choice: core profile for versions 3.2 or higher, or just version 2.1. There is no way to get access to features after 2.1 and still access the Fixed Function Pipeline.

Perhaps this is the problem (needed select or CORE PROFILE and 3.2 or 2.1 without profile)

Also, Possibly (links from google) in MaсOS glGetString(GL_EXTENSIONS) is deprecated. only glGetStringi(GL_EXTENSIONS, i) if num of extention show positive number - needed changes in ogl.cpp

diff --git a/source/lib/ogl.cpp b/source/lib/ogl.cpp
index 575a189383..73777b1685 100644
--- a/source/lib/ogl.cpp
+++ b/source/lib/ogl.cpp
@@ -477,6 +477,9 @@ void ogl_Init()
        // note: this is less about performance (since the above are not
        // time-critical) than centralizing the 'OpenGL is ready' check.
        exts = (const char*)glGetString(GL_EXTENSIONS);
+       GLint ExtensionCount;
+       glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
+       printf("OpenGL version %s, num of extention: %d\n", glGetString(GL_VERSION), ExtensionCount);
        ENSURE(exts);   // else: called before OpenGL is ready for use
        have_12 = ogl_HaveVersion("1.2");
        have_13 = ogl_HaveVersion("1.3");

comment:4 by nwtour, 2 years ago

Try

forceglprofile = "core",
forceglmajorversion = 3,
forceglminorversion = 2

in user.cfg and run bugged revision to check first theory

Last edited 2 years ago by nwtour (previous) (diff)

in reply to:  4 comment:5 by Langbart, 2 years ago

Replying to nwtour:

Try

forceglprofile = "core",
forceglmajorversion = 3,
forceglminorversion = 2

in user.cfg and run bugged revision to check first theory

--> Crash

in reply to:  3 comment:6 by Langbart, 2 years ago

Replying to nwtour:

Also, Possibly (links from google) in MaсOS glGetString(GL_EXTENSIONS) is deprecated. only glGetStringi(GL_EXTENSIONS, i) if num of extention show positive number - needed changes in ogl.cpp

diff --git a/source/lib/ogl.cpp b/source/lib/ogl.cpp
index 575a189383..73777b1685 100644
--- a/source/lib/ogl.cpp
+++ b/source/lib/ogl.cpp
@@ -477,6 +477,9 @@ void ogl_Init()
        // note: this is less about performance (since the above are not
        // time-critical) than centralizing the 'OpenGL is ready' check.
        exts = (const char*)glGetString(GL_EXTENSIONS);
+       GLint ExtensionCount;
+       glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
+       printf("OpenGL version %s, num of extention: %d\n", glGetString(GL_VERSION), ExtensionCount);
        ENSURE(exts);   // else: called before OpenGL is ready for use
        have_12 = ogl_HaveVersion("1.2");
        have_13 = ogl_HaveVersion("1.3");

I could compile with
glGetIntegerv(GL_EXTENSIONS, &ExtensionCount);, but not with glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);.

Starting the game also results in an instant crash.

comment:7 by nwtour, 2 years ago

I wrote the wrong user.cfg parameters. Such a line should return pre-commit behavior:

forceglmajorversion = "1"
forceglminorversion = "4"
forceglprofile = "compatibility"
forceglversion = "true"

Such a line to test the possibility of version 2.1:

forceglmajorversion = "2"
forceglminorversion = "1"
forceglprofile = "compatibility"
forceglversion = "true"

Such a string to test the theory with the core profile dichotomy on MacOS:

forceglmajorversion = "3"
forceglminorversion = "2"
forceglprofile = "core"
forceglversion = "true"

comment:8 by Langbart, 2 years ago

I am currently on the latest git version [26040] (10/Dec/21 - 4am Berlin timezone).
If I add the following three lines to my user.cfg, I can play the game.

forceglmajorversion = "2"
forceglminorversion = "1"
forceglversion = "true"

Very good.

comment:9 by Vladislav Belov, 2 years ago

Owner: set to Vladislav Belov
Patch: D4370
Status: newassigned

comment:10 by Vladislav Belov, 2 years ago

Patch: D4370[https://code.wildfiregames.com/D4370 D4370]

comment:11 by Vladislav Belov, 2 years ago

Resolution: fixed
Status: assignedclosed

In 26051:

Resolves concerns from rP26031. Fixes #6395

Tested By: Langbart, nwtour

Differential Revision: https://code.wildfiregames.com/D4370

Note: See TracTickets for help on using tickets.