[Guide] Compile GZDoom on OpenBSD

For guides related to programming and compiling and working with Doom-related projects

Moderators: GZDoom Developers, Raze Developers

Cacodemon345
Posts: 422
Joined: Fri Dec 22, 2017 1:53 am
Graphics Processor: ATI/AMD (Modern GZDoom)

[Guide] Compile GZDoom on OpenBSD

Post by Cacodemon345 »

This is a guide on how to compile GZDoom on OpenBSD.

Prerequisites (package/port name in parentheses):
  1. OpenAL Soft (openal)
  2. SDL2 (sdl2)
  3. Fluidsynth (fluidsynth, optional)
  4. CMake (cmake)
  5. libsndfile (libsndfile)
  6. libogg (libogg)
  7. GCC from ports/package repository (gcc, g++, available separately)
  8. Git (git)
Instructions:
  • Install the prerequisites like this as root:

    Code: Select all

    pkg_add name-of-package
    Where name-of-package is the name of prerequisite to install. You can optionally install the first 6 prerequisites from the upstreams but the last two must be installed from OpenBSD package repository.
  • Clone the GZDoom and ZMusic upstream git repository:

    Code: Select all

    git clone --recursive https://github.com/coelckers/gzdoom
    git clone https://github.com/coelckers/ZMusic
  • Compile ZMusic:

    Code: Select all

    cd ZMusic
    mkdir build
    cmake -S ./ -B ./build/ -DCMAKE_C_COMPILER=egcc -DCMAKE_CXX_COMPILER=eg++
    cd build
    make
    make install # run this as root
  • Compile GZDoom:

    Code: Select all

    cd gzdoom
    mkdir build
    cmake -S ./ -B ./build/ -DCMAKE_C_COMPILER=egcc -DCMAKE_CXX_COMPILER=eg++ -DCMAKE_PREFIX_PATH=/path/to/ZMusic/build/source/
    cd build
    make
Make sure to suffix the "-jn" argument to the make commands, where "n" is the number of cores you have. Otherwise the builds will be slow.

If you successfully built GZDoom, you should see an executable named "gzdoom" inside the build directory. Copy your IWADs to this directory.

Now launch GZDoom, you should see it making to the title screen.

Problems:
  • I get a black screen after GZDoom launches.
    Cause: Likely related to some dumb changes the OpenBSD developers made to the GLX component (I believe) in Xenocara Mesa3D that causes OpenGL context creation to fail internally despite being reported as being successful to the SDL2 application.
    Solution: Launch GZDoom with EGL forced like this:

    Code: Select all

    SDL_VIDEO_X11_FORCE_EGL=1 ./gzdoom
    This will force SDL2 to use EGL instead of GLX for OpenGL.
  • Size mismatch messages followed by a segmentation fault
    Cause: This will happen if you type "make install" as root after building GZDoom without launching it first from the build directory, causing the OpenBSD executable loader to think that the RTTI classes/structs have different sizes across C++ libraries, leading to a segmentation fault.
    Solution: Launch it first from the build directory before running "make install" as root.
  • GZDoom's crash reporter does not work properly.
    Cause: GZDoom launches the "gdb" program when a crash happens, which in OpenBSD is very old and non-working as compared to GDB from ports which is named "egdb".
    Solution: I will do a solution later, once I figure it out.
  • Vulkan isn't working.
    Cause: ICD files are not available.
    Solution: Create an ICD file by yourself and save them in ~/.local/share/vulkan/icd.d/. See https://github.com/KhronosGroup/Vulkan- ... ile-format for the format.
Let me know if there are problems while following this guide.
Cacodemon345
Posts: 422
Joined: Fri Dec 22, 2017 1:53 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: [Guide] Compile GZDoom on OpenBSD

Post by Cacodemon345 »

Update:
I updated the problems list. Also, the upstream SDL2 now features functional KMSDRM support for OpenBSD complete with WSCONS input backend. You have to edit the /etc/fbtab file for it to work.

Return to “Programming and Compiling”