dougmencken / HeadOverHeels

The free and open source remake of the game “Head over Heels”
GNU General Public License v3.0
33 stars 10 forks source link

oh why did I poke at cygwin again #54

Closed dougmencken closed 7 months ago

dougmencken commented 1 year ago
$ headoverheels
Segmentation fault (core dumped)

$ gdb /usr/bin/headoverheels.exe
GNU gdb (GDB) (Cygwin 12.1-1) 12.1
Reading symbols from /usr/bin/headoverheels.exe...
(gdb) run
Starting program: /usr/bin/headoverheels.exe
[New Thread 13852.0x196c]
[New Thread 13852.0x2698]
[New Thread 13852.0x37cc]
[New Thread 13852.0x204]

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x00000001004037bf in iso::homePath () at Ism.cpp:160
160             if ( HomePath.empty () )
(gdb) bt
#0  0x00000001004037bf in iso::homePath () at Ism.cpp:160
#1  0x000000010044be74 in iso::GameManager::GameManager (this=0x1005223a0 <iso::GameManager::instance>) at GameManager.cpp:34
#2  0x00000001004f99ba in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at GameManager.cpp:25
#3  _GLOBAL__sub_I__ZN3iso11GameManager8instanceE () at GameManager.cpp:1197
#4  0x00007ffbcb8f6562 in cygwin1!.main () from /usr/bin/cygwin1.dll
#5  0x00000001004f80fd in main (argc=1, argv=0xa00001d70) at main.cpp:68
(gdb)
dougmencken commented 1 year ago

what in this universe can ever crash on

https://github.com/dougmencken/HeadOverHeels/blob/7eeddc9bb66a00016a0872e4eec9017a5c30a586/src/Ism.cpp#L160

dougmencken commented 1 year ago

Jorge has the similar crash

imagen

at the very beginning

dougmencken commented 1 year ago
--- a/source/ospaths.cpp
+++ b/source/ospaths.cpp
@@ -115,7 +115,7 @@ void setPathToGame ( const char * pathToGame )
         fprintf( stdout, "FullPathToGame is \"%s\"\n", FullPathToGame.c_str () );
 }

-std::string HomePath ;
+std::string HomePath( "" );

 std::string homePath ()
 {
@@ -144,7 +144,7 @@ std::string homePath ()
         return HomePath;
 }

-std::string SharePath ;
+std::string SharePath( "" );

 std::string sharePath ()
 {

maybe? sorry for mentioning you Jorge @helmantika but I just can't continue my story without fixing your issue ;)

dougmencken commented 1 year ago

it's related to GCC but not cygwin in fact

$ gcc --version
gcc (GCC) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.

doesn't invoke the default constructor (some optimization mmh?) while the version I'm using currently

gcc (GCC) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.

does it

dougmencken commented 1 year ago

currently it's not some initialization of global and static variables where it crashes, but

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x00000004812897f2 in install_timer.part () from /usr/bin/cygalleg-4.4.dll
(gdb) bt
#0  0x00000004812897f2 in install_timer.part () from /usr/bin/cygalleg-4.4.dll
#1  0x0000000100405d2e in allegro::init () at WrappersAllegro.cpp:1179
#2  0x0000000100401129 in initAllegro () at main.cpp:61
#3  0x00000001005011e7 in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:206

I surely have libx11-devel there, and that's what allegro4 prints during configure

-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/libX11.dll.a
-- Looking for XOpenDisplay in /usr/lib/libX11.dll.a - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for XOpenIM in X11
-- Looking for XOpenIM in X11 - found
-- Looking for XDGAQueryExtension in Xxf86dga
-- Looking for XDGAQueryExtension in Xxf86dga - not found
dougmencken commented 7 months ago

MSys2 works well, I'm closing this