bradharding / doomretro

The classic, refined DOOM source port. For Windows PC.
https://www.doomretro.com
GNU General Public License v3.0
698 stars 88 forks source link

Floating point exception when running doom retro #809

Closed poleve540 closed 6 months ago

poleve540 commented 1 year ago

After building and installing, I tried running doomretro from the command line like this :

doomretro -iwad DOOM.WAD

And then I get this output :

Floating point exception (core dumped)

If I don't specify a directory I just get "DOOM Retro counld't find any IWADs."

It's my first time trying to build from source on Linux. I don't know what I'm doing wrong.

git clone https://github.com/bradharding/doomretro
cd doomretro
mkdir build
cmake ..
make
sudo make install
bradharding commented 1 year ago

Thanks for the report. I'm not familiar with Linux in any meaningful way, so I generally can't offer support, but I suspect the bug I just fixed (d7206d44c120c3d1227ff18900d5afee50c1669a) is the cause of this. Can you please try to compile again and confirm?

poleve540 commented 1 year ago

It still gives me the same error unfortunately.

ismagilli commented 1 year ago

Could you please provide a call stack. To do this, you will need to build the program in debug mode and run it under the debugger. You do not need to install the program. I note that you will also need a gdb debugger (in most linux distros, the package is called gdb).

  1. Cloning git repo: git clone https://github.com/bradharding/doomretro;
  2. Enter doomretro dir: cd doomretro;
  3. Compile with debug info: cmake -B build_debug -S . -DCMAKE_BUILD_TYPE=Debug; cmake --build build_debug -- -j4; Now executable file can be found here: build_debug/doomretro;
  4. Run with debugger: gdb -- build_debug/doomretro ARGS where ARGS is doomretro arguments, for example, -iwad DOOM.WAD;
  5. Type run or r command in gdb to run program;
  6. When a problem occurs, type backtrace or bt command in gdb to display the call stack.
poleve540 commented 1 year ago

Sorry that I'm late. Here's the output I got from your instruction. I had to use gdb --args build_debug/doomretro ARGS

(gdb) run
Starting program: /home/salahou/doomretro/build_debug/doomretro -iwad DOOM.WAD
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff63fd640 (LWP 18364)]
[Thread 0x7ffff63fd640 (LWP 18364) exited]

Thread 1 "doomretro" received signal SIGFPE, Arithmetic exception.
0x00005555555f4f9f in I_GetScreenDimensions () at /home/salahou/doomretro/src/i_video.c:1679
1679            WIDESCREENWIDTH = BETWEEN(NONWIDEWIDTH, ((width * ACTUALHEIGHT / height + 1) & ~3), MAXWIDTH);
(gdb) bt
#0  0x00005555555f4f9f in I_GetScreenDimensions ()
    at /home/salahou/doomretro/src/i_video.c:1679
#1  0x00005555555f5793 in I_InitGraphics ()
    at /home/salahou/doomretro/src/i_video.c:1846
#2  0x00005555555dc71f in D_DoomMainSetup ()
    at /home/salahou/doomretro/src/d_main.c:2336
#3  0x00005555555ddb81 in D_DoomMain ()
    at /home/salahou/doomretro/src/d_main.c:2678
#4  0x00005555555ddc32 in main (argc=3, argv=0x7fffffffe078)
    at /home/salahou/doomretro/src/doomretro.c:215
bradharding commented 1 year ago

Ah! Thank you for this. So, height is 0 in this instance, causing a divide by zero error. I'll look into it.

bradharding commented 1 year ago

Can you please tell me what the SDL_VIDEODRIVER environment variable is set to on your system?

poleve540 commented 1 year ago

So if I try printenv SDL_VIDEODRIVER it gives me nothing. The default should be x11?

bradharding commented 1 year ago

It seems that a previous call to an SDL function that it meant to find your display's width and height in pixels failed, leaving height to be 0 causing the crash. After a bit of googling, it could be due to SDL_VIDEODRIVER being set incorrectly. x11 is the default. Does changing that work?