dunelegacy game compiles but dumps core

IRIX/Nekoware development, porting and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
necron2600
Posts: 306
Joined: Tue May 26, 2015 10:38 pm
Location: Boston

dunelegacy game compiles but dumps core

Unread postby necron2600 » Thu Mar 22, 2018 7:33 pm

I am hoping someone far better than I am at this could help identify why dunelegacy is core dumping quickly on start.

Here is the situation:

With a few hacks (which may very cause their own problems), I was able to successfully compile dunelegacy 0.96.2 with gcc4.. but it coredumps before loading the main menu/screen. The latest version 0.96.4 uses SDL2.0 so that is out of the question with nekoware as it is today.

If you do not have any game data files setup.. then it does display a graphical SDL window saying it needs game data files. Once the game data files are there, it will coredump quickly. It should start displaying a game menu of sorts.

Log file gets stored in ~/.config/dunelegacy . I was able to compare a working Linux version with the compiled IRIX one..
Linux:
loading fonts..... finished
loading graphics..... finished
loading sounds..... finished
loading texts..... finished
IRIX:
loading fonts..... finished
loading graphics.....
<CORE DUMPS>

I recompiled with GCC debugging (-g) and analyzed the coredump with gdb:
gdb /usr/local/bin/dunelegacy core
[...]
Core was generated by `dunelegacy'.
Program terminated with signal 10, Bus error.

warning: wrong size gregset struct in core file
Reading symbols from /usr/nekoware/lib/libSDL-1.2.so.1...done.
Loaded symbols for /usr/nekoware/lib/libSDL-1.2.so.1
Reading symbols from /usr/lib32/libpthread.so...done.
Loaded symbols for /usr/lib32/libpthread.so
Reading symbols from /usr/nekoware/lib/libSDL_mixer-1.2.so.1...done.
Loaded symbols for /usr/nekoware/lib/libSDL_mixer-1.2.so.1
Reading symbols from /usr/lib32/libm.so...done.
Loaded symbols for /usr/lib32/libm.so
Reading symbols from /usr/lib32/libc.so.1...done.
Loaded symbols for /usr/lib32/libc.so.1
Reading symbols from /usr/nekoware/lib/libiconv.so.3...done.
Loaded symbols for /usr/nekoware/lib/libiconv.so.3
Reading symbols from /usr/lib32/libaudio.so...done.
Loaded symbols for /usr/lib32/libaudio.so
Reading symbols from /usr/lib32/libX11.so.1...done.
Loaded symbols for /usr/lib32/libX11.so.1
Reading symbols from /usr/lib32/libXext.so...done.
Loaded symbols for /usr/lib32/libXext.so
Reading symbols from /usr/lib32/libfastm.so...done.
Loaded symbols for /usr/lib32/libfastm.so
Reading symbols from /usr/nekoware/lib/libmikmod.so.4...done.
Loaded symbols for /usr/nekoware/lib/libmikmod.so.4

warning: wrong size gregset struct in core file
#0 0x00000000 in ?? ()
(gdb) frame 0
#0 0x00000000 in ?? ()
(gdb) list
280 to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT
281 { return static_cast<char_type>(__c); }
282
283 // To keep both the byte 0xff and the eof symbol 0xffffffff
284 // from ending up as 0xffffffff.
285 static _GLIBCXX_CONSTEXPR int_type
286 to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT
287 { return static_cast<int_type>(static_cast<unsigned char>(__c)); }288
289 static _GLIBCXX_CONSTEXPR bool
(gdb) frame 1
#1 0x00000000 in ?? ()
(gdb) list
290 eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT
291 { return __c1 == __c2; }
292
293 static _GLIBCXX_CONSTEXPR int_type
294 eof() _GLIBCXX_NOEXCEPT
295 { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
296
297 static _GLIBCXX_CONSTEXPR int_type
298 not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT
299 { return (__c == eof()) ? 0 : __c; }


Here is the original source: (no one needs to d/l this unless they want to try debugging or hacking code)
dunelegacy-0.96.2-src.tar.gz
Dune legacy original source files (nothing special here)
(1.48 MiB) Downloaded 5 times


Here is my patch.. It's largely FP_NAN hacks, lround and lrint workarounds. While these hacks could pose problems, I do not believe they are the cause of the core dumping on app start but you never know. Maybe someone else has a better idea for handling lround() and lrint() with gcc/g++ on IRIX?
dunelegacy-0.96.2-irix-patch.txt
patch file of hacks for dunelegacy to compile on IRIX
(6.06 KiB) Downloaded 8 times


My environment:
GNUMAKE=/usr/nekoware/bin/make
PKG_CONFIG=/usr/nekoware/bin/pkg-config
PKG_CONFIG_LIBDIR=/usr/nekoware/lib
CFLAGS=-O3 -mabi=n32 -I/usr/nekoware/include -I/usr/include
CC=gcc
CXXFLAGS=-O3 -mabi=n32 -I/usr/nekoware/include -I/usr/include
LD_LIBRARY64_PATH=/usr/nekoware/lib64
CXX=g++
INSTALL=/usr/nekoware/bin/install
CPPFLAGS=-O3 -mabi=n32 -I/usr/nekoware/include -I/usr/include
LD_LIBRARYN32_PATH=/usr/nekoware/lib
LDFLAGS=-L/usr/nekoware/lib -L/usr/lib32
PATH=/usr/nekoware/gcc-4.7/bin:/opt/bin:/usr/bsd:/usr/local/bin:/usr/local/sbin:/usr/nekoware/bin:/usr/nekoware/sbin:
PKG_CONFIG_PATH=/usr/nekoware/lib/pkgconfig:/usr/nekoware/qt4/lib/pkgconfig/
_=/sbin/env

Build steps:
autoreconf --install
Edit configure; replace line if its not set right: CXXFLAGS="-O3 -mabi=n32 -I/usr/nekoware/include -I/usr/include"
./configure
gmake
gmake install # as root .. default goes to /usr/local/

Game data files:
Place in ~/.config/dunelegacy/data/
Find example game files:
https://www.linuxquestions.org/question ... acy-586157

At the very least.. dunelegacy on IRIX attempt is documented here in this thread for future use/reference.

User avatar
necron2600
Posts: 306
Joined: Tue May 26, 2015 10:38 pm
Location: Boston

Re: dunelegacy game compiles but dumps core

Unread postby necron2600 » Thu Mar 22, 2018 8:06 pm

Another core dump.. seems it shows different parts of code each time. Usually it has bits of memcmp or memmove showing.

(gdb) frame 0
#0 0x00000000 in ?? ()
(gdb) list
260 length(const char_type* __s)
261 { return __builtin_strlen(__s); }
262
263 static const char_type*
264 find(const char_type* __s, size_t __n, const char_type& __a)
265 { return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n)); }
266
267 static char_type*
268 move(char_type* __s1, const char_type* __s2, size_t __n)
269 { return static_cast<char_type*>(__builtin_memmove(__s1, __s2, __n)); }

User avatar
duck
Donor
Donor
Posts: 762
Joined: Mon Oct 27, 2003 5:22 pm
Location: Jakobstad, Finland
Contact:

Re: dunelegacy game compiles but dumps core

Unread postby duck » Fri Mar 23, 2018 1:35 pm

I'd suggest running bt instead of trying to guess the relevant frame.

Code: Select all

___(o)=
\____)

User avatar
necron2600
Posts: 306
Joined: Tue May 26, 2015 10:38 pm
Location: Boston

Re: dunelegacy game compiles but dumps core

Unread postby necron2600 » Sat Mar 24, 2018 9:52 pm

There must be something going wrong on my side if I only get 2 frames:
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x00000000 in ?? ()
Previous frame identical to this frame (corrupt stack?)
(gdb) thread apply all bt
(gdb)

Not to mention that the entire source code to step through in gdb is from a libstdc++ header:
/usr/nekoware/gcc-4.7/include/c++/4.7.1/bits/char_traits.h
// Character Traits for use by standard string and iostream -*- C++ -*-

I am compiling with: (as seen in Makefile and during compilation output):
CPPFLAGS = -O0 -ggdb -mabi=n32 -I/usr/nekoware/include -I/usr/include


Return to “SGI: Development”

Who is online

Users browsing this forum: Yandex [Bot] and 4 guests