Page 1 of 6
Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 12:08
by vanfanel
Hi,
Since ZDOOM is dead, and that was my sourceport of choice on the Raspberry Pi 3 computer (on wich it runs great, except for some compilation problems), I have decided to give GZDoom a try.
However, the Pi does not have an stable, hardware-accelerated OpenGL. It however has GLES1 and GLES2 wich work great and can be initialized from SDL2 (since SDL2 DOES support the Raspberry's native windowing system: it's abstracted by SDL2 so GLES apps work easily).
As GZDoom is now, it won't build on the Pi because of the lack of OpenGL:
Code: Select all
pi@raspberrypi:~/src/gzdoom/b3 $ cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 6.1.0
-- The CXX compiler identification is GNU 6.1.0
-- Check for working C compiler: /usr/local/gcc-6.1.0/bin/cc
-- Check for working C compiler: /usr/local/gcc-6.1.0/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/gcc-6.1.0/bin/g++
-- Check for working CXX compiler: /usr/local/gcc-6.1.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- Found JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8")
-- Could NOT find GME (missing: GME_LIBRARIES GME_INCLUDE_DIR)
-- Using system zlib, includes found at /usr/include
-- Using system jpeg library, includes found at /usr/include
-- Using internal bzip2 library
-- Using internal gme library
-- Performing Test HAVE_NO_ARRAY_BOUNDS
-- Performing Test HAVE_NO_ARRAY_BOUNDS - Success
-- Performing Test __LIBGME_TEST_VISIBILITY
-- Performing Test __LIBGME_TEST_VISIBILITY - Success
-- Looking for strdup
-- Looking for strdup - found
-- Looking for strndup
-- Looking for strndup - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of 0i8
-- Check size of 0i8 - failed
-- Check size of 0l
-- Check size of 0l - done
-- Check size of 0ll
-- Check size of 0ll - done
-- Check size of char
-- Check size of char - done
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of long long
-- Check size of long long - done
-- Check size of void *
-- Check size of void * - done
-- Check size of __int64
-- Check size of __int64 - failed
-- Looking for itoa
-- Looking for itoa - not found
-- Performing Test DUMB_CAN_USE_SSE
-- Performing Test DUMB_CAN_USE_SSE - Failed
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
-- checking for module 'gtk+-3.0'
-- package 'gtk+-3.0' not found
-- checking for module 'gtk+-2.0'
-- package 'gtk+-2.0' not found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SDL2: /usr/lib/libSDL2main.a;/usr/lib/libSDL2.so;-lpthread
CMake Error at src/CMakeLists.txt:261 (message):
OpenGL is required for building.
-- Configuring incomplete, errors occurred!
See also "/home/pi/src/gzdoom/b3/CMakeFiles/CMakeOutput.log".
See also "/home/pi/src/gzdoom/b3/CMakeFiles/CMakeError.log".
So, can OpenGL be disabled somehow? Better yet, could GZDoom eventually support GLES2? If it runs on modern GL, it should be easy for the GZDoom programmers to do the jump into GLES with SDL2 initialization.
Re: Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 12:47
by Graf Zahl
A pull request for disabling OpenGL is in the pipeline, it should be ready soon.
GLES is a different matter - it will require some changes to the code, how much depends on which GLES version to support. GLES 2 will be a problem because it lacks support for many features the modern render path needs and the legacy render path depends on fixed function features.
Essentially GLES 2 falls right through the cracks, it's caught in the middle and hard to adjust to either side.
GLES 3.1 may be easier but seeing that so many AMD-based devices cannot handle it may be a bit of a turn-off.
Re: Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 13:52
by _mental_
vanfanel wrote:So, can OpenGL be disabled somehow?
Could you please try
this PR ? This will be the best confirmation that nothing was missed in making OpenGL dependency fully dynamic.
Re: Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 14:46
by vanfanel
@_mental_: with that PR, it builds. However it crashes upon launch:
Code: Select all
pi@raspberrypi:~/doom $ ./doom
GZDoom <unknown version> - - SDL version
Compiled on Jan 14 2017
M_LoadDefaults: Load system defaults.
W_Init: Init WADfiles.
adding /home/pi/doom/gzdoom.pk3, 677 lumps
adding doomu.wad, 2306 lumps
I_Init: Setting up machine state.
I_InitSound: Initializing OpenAL
Opened device ALSA Default
EFX enabled
V_Init: allocate screen.
S_Init: Setting up sound.
ST_Init: Init startup screen.
Checking cmd-line parameters...
S_InitData: Load sound definitions.
G_ParseMapInfo: Load map definitions.
Texman.Init: Init texture manager.
ParseTeamInfo: Load team definitions.
LoadActors: Load actor definitions.
script parsing took 1170.36 ms
R_Init: Init Doom refresh subsystem.
DecalLibrary: Load decals.
M_Init: Init menus.
P_Init: Init Playloop state.
ParseSBarInfo: Loading default status bar definition.
ParseSBarInfo: Loading custom status bar definition.
D_CheckNetGame: Checking network game status.
player 1 of 1 (1 nodes)
Using video driver RPI
*** Fatal Error ***
Address not mapped to object (signal 11)
Address: (nil)
Generating gzdoom-crash.log and killing process 307, please wait... warning: File "/usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.22-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
40 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
sh: 1: xmessage: not found
./doom: line 2: 307 Killed ./gzdoom -iwad doomu.wad
Re: Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 14:49
by dpJudas
Try launch it with +vid_renderer 0
Re: Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 15:11
by _mental_
vanfanel wrote:However it crashes upon launch
Do you have
gdb to get a backtrace after the crash? Or attach
gzdoom-crash.log, it may have required information.
Re: Building GZDOOM without OPENGL
Posted: Tue Jan 17, 2017 15:13
by vanfanel
It works now!
However with some problems:
-If video mode is set to 320x200 (so SDL2 makes the fullscreen scaling in hardware and CPU usage comes down dramatically) text messages appear in a GIGANTIC size
-Crashes on exit, trying to free something:
Code: Select all
pi@raspberrypi:~/doom $ ./doom
GZDoom <unknown version> - - SDL version
Compiled on Jan 14 2017
M_LoadDefaults: Load system defaults.
W_Init: Init WADfiles.
adding /home/pi/doom/gzdoom.pk3, 677 lumps
adding doomu.wad, 2306 lumps
I_Init: Setting up machine state.
I_InitSound: Initializing OpenAL
Opened device ALSA Default
EFX enabled
V_Init: allocate screen.
S_Init: Setting up sound.
ST_Init: Init startup screen.
Checking cmd-line parameters...
S_InitData: Load sound definitions.
G_ParseMapInfo: Load map definitions.
Texman.Init: Init texture manager.
ParseTeamInfo: Load team definitions.
LoadActors: Load actor definitions.
script parsing took 1115.89 ms
R_Init: Init Doom refresh subsystem.
DecalLibrary: Load decals.
M_Init: Init menus.
P_Init: Init Playloop state.
ParseSBarInfo: Loading default status bar definition.
ParseSBarInfo: Loading custom status bar definition.
D_CheckNetGame: Checking network game status.
player 1 of 1 (1 nodes)
Using video driver RPI
Resolution: 320 x 200
*** Error in `./gzdoom': free(): invalid pointer: 0x006fd7b4 ***
./doom: line 2: 32470 Aborted ./gzdoom +vid_renderer 0 -iwad doomu.wad
Re: Building GZDOOM without OPENGL
Posted: Wed Jan 18, 2017 15:49
by Edward-san
The crash on exit was fixed in gzdoom some days ago. Please try again now with the PR, as I rebased the change on top of more recent gzdoom commits.
Re: Building GZDOOM without OPENGL
Posted: Thu Jan 19, 2017 15:29
by vanfanel
There's something wrong with the new PR...
Code: Select all
pi@raspberrypi:~/src $ git clone --depth 1 https://github.com/coelckers/gzdoom.git && sync
Cloning into 'gzdoom'...
remote: Counting objects: 2799, done.
remote: Compressing objects: 100% (2618/2618), done.
remote: Total 2799 (delta 239), reused 1591 (delta 136), pack-reused 0
Receiving objects: 100% (2799/2799), 6.30 MiB | 1.07 MiB/s, done.
Resolving deltas: 100% (239/239), done.
Checking connectivity... done.
pi@raspberrypi:~/src $ cd gzdoom/
pi@raspberrypi:~/src/gzdoom $ git fetch origin pull/213/head:pr-213
remote: Counting objects: 90515, done.
remote: Compressing objects: 100% (16828/16828), done.
remote: Total 90515 (delta 74997), reused 89052 (delta 73541), pack-reused 0
Receiving objects: 100% (90515/90515), 37.77 MiB | 1.18 MiB/s, done.
Resolving deltas: 100% (74997/74997), completed with 1110 local objects.
From https://github.com/coelckers/gzdoom
* [new ref] refs/pull/213/head -> pr-213
* [new tag] 2.1.0 -> 2.1.0
* [new tag] 2.1.1 -> 2.1.1
* [new tag] 2.1.2 -> 2.1.2
* [new tag] 2.1.3 -> 2.1.3
* [new tag] 2.1.4 -> 2.1.4
* [new tag] 2.1.5 -> 2.1.5
* [new tag] 2.1.6 -> 2.1.6
* [new tag] 2.1.7 -> 2.1.7
* [new tag] 2.2.0 -> 2.2.0
* [new tag] 2.3.0 -> 2.3.0
* [new tag] 2.3.1 -> 2.3.1
* [new tag] 2.5.0 -> 2.5.0
* [new tag] 2.7.0 -> 2.7.0
* [new tag] 2.8.0 -> 2.8.0
* [new tag] 2.8.9999 -> 2.8.9999
* [new tag] 2.8pre -> 2.8pre
* [new tag] 2.9pre -> 2.9pre
* [new tag] G1.9pre -> G1.9pre
* [new tag] g2.0.01pre -> g2.0.01pre
* [new tag] g2.1.pre -> g2.1.pre
* [new tag] g2.1pre -> g2.1pre
* [new tag] g2.2pre -> g2.2pre
* [new tag] g2.3pre -> g2.3pre
* [new tag] g2.4pre -> g2.4pre
* [new tag] notok#2 -> notok#2
* [new tag] ok3 -> ok3
* [new tag] test_1 -> test_1
pi@raspberrypi:~/src/gzdoom $ git checkout pr-213
Switched to branch 'pr-213'
pi@raspberrypi:~/src/gzdoom $ mkdir b3
pi@raspberrypi:~/src/gzdoom $ cd b3
pi@raspberrypi:~/src/gzdoom/b3 $ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 6.1.0
-- The CXX compiler identification is GNU 6.1.0
-- Check for working C compiler: /usr/local/gcc-6.1.0/bin/cc
-- Check for working C compiler: /usr/local/gcc-6.1.0/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/gcc-6.1.0/bin/g++
-- Check for working CXX compiler: /usr/local/gcc-6.1.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- Found JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8")
-- Could NOT find GME (missing: GME_LIBRARIES GME_INCLUDE_DIR)
-- Using system zlib, includes found at /usr/include
-- Using system jpeg library, includes found at /usr/include
-- Using internal bzip2 library
-- Using internal gme library
-- Performing Test HAVE_NO_ARRAY_BOUNDS
-- Performing Test HAVE_NO_ARRAY_BOUNDS - Success
-- Performing Test __LIBGME_TEST_VISIBILITY
-- Performing Test __LIBGME_TEST_VISIBILITY - Success
-- Looking for strdup
-- Looking for strdup - found
-- Looking for strndup
-- Looking for strndup - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of 0i8
-- Check size of 0i8 - failed
-- Check size of 0l
-- Check size of 0l - done
-- Check size of 0ll
-- Check size of 0ll - done
-- Check size of char
-- Check size of char - done
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of long long
-- Check size of long long - done
-- Check size of void *
-- Check size of void * - done
-- Check size of __int64
-- Check size of __int64 - failed
-- Looking for itoa
-- Looking for itoa - not found
-- Performing Test DUMB_CAN_USE_SSE
-- Performing Test DUMB_CAN_USE_SSE - Failed
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- checking for module 'gtk+-3.0'
-- package 'gtk+-3.0' not found
-- checking for module 'gtk+-2.0'
-- package 'gtk+-2.0' not found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SDL2: /usr/lib/libSDL2main.a;/usr/lib/libSDL2.so;-lpthread
-- Found OpenAL: /usr/lib/libopenal.so
-- Could not find FMOD include files
-- Could NOT find SndFile (missing: SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
-- Found MPG123: /usr/lib/arm-linux-gnueabihf/libmpg123.so
-- Could NOT find FluidSynth (missing: FLUIDSYNTH_LIBRARIES FLUIDSYNTH_INCLUDE_DIR)
-- Performing Test CAN_DO_MFPMATH
-- Performing Test CAN_DO_MFPMATH - Failed
-- Performing Test CAN_DO_ARCHSSE2
-- Performing Test CAN_DO_ARCHSSE2 - Failed
-- Performing Test HAVE_MMX
-- Performing Test HAVE_MMX - Failed
-- Performing Test CAN_DO_CPP14
-- Performing Test CAN_DO_CPP14 - Success
-- Looking for filelength
-- Looking for filelength - not found
-- Looking for strupr
-- Looking for strupr - not found
-- Looking for stricmp
-- Looking for stricmp - not found
-- Looking for strnicmp
-- Looking for strnicmp - not found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Fluid synth libs: FLUIDSYNTH_LIBRARIES-NOTFOUND
-- Configuring done
CMake Error at src/CMakeLists.txt:1246 (add_executable):
Cannot find source file:
g_inventory/a_ammo.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
-- Build files have been written to: /home/pi/src/gzdoom/b3
Unless I am doing something wrong, it's missing files so it won't build...
If there's a github repo I can simply clone instead of doing all this stuff to test the PR, please tell me. It will save me time.
Re: Building GZDOOM without OPENGL
Posted: Thu Jan 19, 2017 16:17
by Edward-san
Sorry, try again now.
I accidentally rebased on a broken commit, now it's rebased on 3b55406.
Re: Building GZDOOM without OPENGL
Posted: Thu Jan 19, 2017 18:14
by Rachael
It's best to do the following when testing someone's PR, anyway:
Code: Select all
git fetch
git checkout -B master origin/master
git pull https://github.com/coelckers/gzdoom pull/123/head
replace 123 with the actual pull request number.
Re: Building GZDOOM without OPENGL
Posted: Thu Jan 19, 2017 22:28
by vanfanel
@eruanna: thanks for the advice, I will do that from now on

@Edward-san: it builds now, but the crash on exit is still there. I have tried to debug, but the debug build creates and destroys INFINITE threads at the beggining and the game doesn't start drawing to screen.
This issue (inifine threads being created and destroyed, segfault at exit...) seems familiar. Something similar was fixed in ZDOOM last year...
EDIT: Here it was! ->
https://forum.zdoom.org/viewtopic.php?f=2&t=51851
It was (and rearding GZDOOM, it still is) an alignment problem that only shows on ARM, it seems.
Re: Building GZDOOM without OPENGL
Posted: Fri Jan 20, 2017 18:43
by Edward-san
Without a way to know where it crashes, it won't be investigated.
Re: Building GZDOOM without OPENGL
Posted: Fri Jan 20, 2017 18:51
by Rachael
For the alignment problem you need to upgrade GCC. Raspbian's is just too old and does not have the proper optimization code. I do not have problems using a build compiled in Ubuntu Mate.
I also do not condone supporting such a dated version of GCC that is so obviously buggy when a newer one is available - even if the old and buggy one is what's officially available for Raspbian.
Re: Building GZDOOM without OPENGL
Posted: Fri Jan 20, 2017 19:23
by vanfanel
@Eruanna: can you please tell me whar gcc -v says on your pi, please? Mine is 6.1.0 currently, I upgraded from Raspbian's GCC months ago.