afwbkbc / glsmac

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

Crashes on arch linux #3

Closed hartmark closed 1 year ago

hartmark commented 1 year ago

It seems to be missing arialn.ttf, it is there however, but it's named ARIALN.TTF, so the same with uppercase. The folder is on btrfs partition so it has case sensitive mode of filenames.

% gdb --args ./bin/GLSMAC /data/lutris/sid-meiers-alpha-centauri/drive_c/GOG\ Games/Sid\ Meier\'s\ Alpha\ Centauri/
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/GLSMAC...
(gdb) r
Starting program: /home/markus/code/glsmac/bin/GLSMAC /data/lutris/sid-meiers-alpha-centauri/drive_c/GOG\ Games/Sid\ Meier\'s\ Alpha\ Centauri/

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org 
Enable debuginfod for this session? (y or [n]) 
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after fork from child process 88857]
[New Thread 0x7ffff69996c0 (LWP 88858)]
<Thread::(MAIN)#51> Starting thread
[New Thread 0x7ffff61986c0 (LWP 88859)]
<Input::SDL2::#6> Initializing SDL2
<Thread::(NETWORK)#52> Starting thread
<Thread::(NETWORK)#52> Thread started, entering main loop
<Graphics::OpenGL::#7> Initializing SDL2
<Graphics::OpenGL::#7> Creating window
[New Thread 0x7ffff49ff6c0 (LWP 88860)]
[New Thread 0x7fffdbfff6c0 (LWP 88861)]
[New Thread 0x7fffdb7fe6c0 (LWP 88862)]
[New Thread 0x7fffdaffd6c0 (LWP 88863)]
[New Thread 0x7fffda7fc6c0 (LWP 88864)]
[New Thread 0x7fffd9ffb6c0 (LWP 88865)]
[Thread 0x7fffd9ffb6c0 (LWP 88865) exited]
[Thread 0x7fffda7fc6c0 (LWP 88864) exited]
<Graphics::OpenGL::#7> Initializing OpenGL
[New Thread 0x7fffda7fc6c0 (LWP 88866)]
[New Thread 0x7fffd9ffb6c0 (LWP 88867)]
<ShaderProgram::Orthographic::#8> Adding shaders
<ShaderProgram::Simple2D::#10> Adding shaders
<ShaderProgram::Font::#12> Adding shaders
<Audio::SDL2::#14> Initializing SDL2
[New Thread 0x7fffe052a6c0 (LWP 88868)]
[New Thread 0x7fffd97fa6c0 (LWP 88869)]
<UI::Default::#17> Creating UI
<Graphics::OpenGL::#7> Adding scene [Scene::(UIShape)#53]
<Routine::Overlay::#11> Scene [Scene::(UIShape)#53] added
<Graphics::OpenGL::#7> Adding scene [Scene::(UIText)#55]
<Routine::Font::#13> Scene [Scene::(UIText)#55] added
<Graphics::OpenGL::#7> Adding scene [Scene::(UIDebug)#60]
<Routine::Overlay::#11> Scene [Scene::(UIDebug)#60] added
<Scheduler::Simple::#21> Starting task [Task::DebugOverlay::#23]
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to load font "arialn.ttf"

Thread 2 "GLSMAC" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff69996c0 (LWP 88858)]
0x00007ffff75b964c in ?? () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff75b964c in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff7569938 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff755353d in abort () from /usr/lib/libc.so.6
#3  0x00007ffff789a833 in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007ffff78a6ccc in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff78a6d39 in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff78a6f9d in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x555555846ae0 <typeinfo for std::runtime_error@GLIBCXX_3.4>, dest=0x7ffff78be440 <std::runtime_error::~runtime_error()>)
    at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98
#7  0x00005555556d0086 in loader::font::FreeType::LoadFont (this=0x7fffffffc970, name="arialn.ttf", size=16 '\020') at /home/markus/code/glsmac/src/loader/font/FreeType.cpp:46
#8  0x00005555557bb39a in debug::DebugOverlay::Start (this=0x5555558672d0) at /home/markus/code/glsmac/src/debug/DebugOverlay.cpp:22
#9  0x00005555557149ec in scheduler::Simple::Start (this=0x7fffffffccb0) at /home/markus/code/glsmac/src/scheduler/Simple.cpp:23
#10 0x00005555556c364d in base::Thread::Run (this=0x555555887180) at /home/markus/code/glsmac/src/base/Thread.cpp:55
#11 0x00005555556c5b38 in std::__invoke_impl<void, void (base::Thread::*)(), base::Thread*> (__f=@0x555555887650: (void (base::Thread::*)(base::Thread * const)) 0x5555556c3492 <base::Thread::Run()>, 
    __t=@0x555555887648: 0x555555887180) at /usr/include/c++/12.2.1/bits/invoke.h:74
#12 0x00005555556c5a97 in std::__invoke<void (base::Thread::*)(), base::Thread*> (__fn=@0x555555887650: (void (base::Thread::*)(base::Thread * const)) 0x5555556c3492 <base::Thread::Run()>) at /usr/include/c++/12.2.1/bits/invoke.h:96
#13 0x00005555556c5a07 in std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> >::_M_invoke<0ul, 1ul> (this=0x555555887648) at /usr/include/c++/12.2.1/bits/std_thread.h:258
#14 0x00005555556c59c0 in std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> >::operator() (this=0x555555887648) at /usr/include/c++/12.2.1/bits/std_thread.h:265
#15 0x00005555556c59a4 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> > >::_M_run (this=0x555555887640) at /usr/include/c++/12.2.1/bits/std_thread.h:210
#16 0x00007ffff78d7283 in std::execute_native_thread_routine (__p=0x555555887640) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82
#17 0x00007ffff75b78fd in ?? () from /usr/lib/libc.so.6
#18 0x00007ffff7639d20 in ?? () from /usr/lib/libc.so.6
afwbkbc commented 1 year ago

Added workaround in 78accf379042e662676a5754e162f53ab90f2c08, please test.

hartmark commented 1 year ago

It doesn't compile on latest on main,

/usr/bin/ld: CMakeFiles/GLSMAC.dir/src/game/world/map_generator/SimplePerlin.cpp.o: warning: relocation against `_ZN4game5world3map4Tile9R_ROLLINGE' in read-only section `.text'
/usr/bin/ld: CMakeFiles/GLSMAC.dir/src/game/world/map_generator/SimplePerlin.cpp.o: in function `game::world::map_generator::SimplePerlin::Generate(game::world::map::Tiles*)::{lambda(game::world::map::Tile*)#1}::operator()(game::world::map::Tile*) const':
/home/markus/code/glsmac/src/game/world/map_generator/SimplePerlin.cpp:74: undefined reference to `game::world::map::Tile::R_ROLLING'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/GLSMAC.dir/build.make:2097: bin/GLSMAC] Error 1
make[1]: *** [CMakeFiles/Makefile2:961: CMakeFiles/GLSMAC.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
make -j24  121.06s user 10.18s system 1591% cpu 8.246 total
 % git bisect good                              
b4cfa5dd621b8dfb19c0583c6828325731a97e46 is the first bad commit
commit b4cfa5dd621b8dfb19c0583c6828325731a97e46
Author: afwbkbc <afwbkbc@inbox.lv>
Date:   Sun Jan 29 03:31:48 2023 +0200

    SimplePerlin map generator (press QuickStart to test)

 src/game/world/World.cpp                      |   9 +-
 src/game/world/map/Map.cpp                    |   2 +-
 src/game/world/map/Tile.cpp                   |   4 +
 src/game/world/map/Tile.h                     |   4 +-
 src/game/world/map_generator/CMakeLists.txt   |   1 +
 src/game/world/map_generator/SimplePerlin.cpp |  85 +++++++++++++++++++
 src/game/world/map_generator/SimplePerlin.h   |  18 ++++
 src/types/Vec2.h                              |  11 ++-
 src/util/CMakeLists.txt                       |   1 +
 src/util/Clamper.h                            |   6 ++
 src/util/Perlin.cpp                           | 115 ++++++++++++++++++++++++++
 src/util/Perlin.h                             |  34 ++++++++
 12 files changed, 284 insertions(+), 6 deletions(-)
 create mode 100644 src/game/world/map_generator/SimplePerlin.cpp
 create mode 100644 src/game/world/map_generator/SimplePerlin.h
 create mode 100644 src/util/Perlin.cpp
 create mode 100644 src/util/Perlin.h

I can start the game however if I revert that commit.

afwbkbc commented 1 year ago

I had it too, already fixed. GCC behaved funny when I tried to do min( ... ) or max( ... ) with typedefed uint8_t.