In this guide, we'll explore how to compile the 'Dry' game engine and the 'Park' game from source on Fedora Linux with debugging enabled. This process will give you a deeper understanding of the inner workings of game development and the satisfaction of running a game you built yourself.
For Ubuntu, go here for pre-compiled game:
Prerequisites
Before diving in, ensure you have the necessary tools and libraries installed:
- Git
- CMake
- GNU Make
- GCC or Clang
- X11 and audio system development libraries
Install these on Fedora with:
sudo dnf groupinstall "Development Tools"
sudo dnf install cmake git gcc-c++ libX11-devel libXcursor-devel libXinerama-devel libXi-devel libXrandr-devel libXrender-devel libXScrnSaver-devel libXxf86vm-devel pulseaudio-libs-devel nas-libs-devel qt5-qtbase-devel
Cloning the Repositories
Clone the 'Dry' and 'Park' repositories using Git:
cd ~/git
git clone https://gitlab.com/luckeyproductions/dry.git
git clone https://gitlab.com/luckeyproductions/games/park.git
Building Dry with Debugging Enabled
Navigate to the 'dry' directory and prepare the build environment:
cd dry
mkdir build && cd build
Configure the build with CMake and enable debugging:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DDRY_64BIT=1
Compile the Dry library with debug symbols:
make
Building Park with Debugging Enabled
In the 'Park' project, modify the Park.pro file to add the -g -O0 flags for debugging, for example:
QMAKE_CXXFLAGS += -std=c++17 -g -O0
Then set the DRY_HOME environment variable to the path of your compiled Dry library:
export DRY_HOME=/home/fox/git/dry/build
Navigate to the 'park' directory and compile the game:
cd /home/fox/git/park
mkdir build && cd build
qmake ../Park.pro
make
cp -r ../Resources .
Running Park
After a successful build, run the Park executable located in the build directory:
./park
Analyzing Core Dumps on Fedora
If your application crashes, Fedora can generate core dumps, which are snapshots of the program's state at the time of the crash. These can be invaluable for debugging.
List recent core dumps with:
coredumpctl list
To analyze a specific core dump, use gdb:
gdb /path/to/executable /path/to/coredump
For example:
gdb /home/fox/git/park/Park/park core.291993
Once in gdb, use the bt command to print a backtrace:
(gdb) bt
This will show you the call stack at the time of the crash, which can help pinpoint the source of the problem.
Happy building and debugging!