[WIP] KeeperRL - compiling from source


PowerGod

Forum Addict!
Joined
Jun 20, 2011
Messages
4,625
To make the forum less silent, I'll use this thread as a LOG while I'm trying to compile a game from source on the Pyra, to put everyting in a DBP later.
It's the first time I try this so I'll write all the issues I find and the solutions.

KeeperRL is a cool game, a blend between Dungeon Keeper and Rogue.



The source code is FREE to use, the game will NOT contain graphic and sounds (only unicode characters), but those can be added later from the commercial version (in the main site is not listed, but the game is available also on GOG.com).


Let's start.

I need to create a folder where to put the sources to be compiled.
Code:
mkdir ~/TOCOMPILE
cd TOCOMPILE

I am on Debian Bookworm, and "git" is not installed by default, so i need to add it to get the code from git
Code:
sudo apt-get install git
git clone https://github.com/miki151/keeperrl.git
cd keeperrl

Now I need to know what is needed to compile, there's a "README.md" in the folder that propose some libraries/utilities.
Code:
sudo apt-get install libsdl2-dev libsdl2-image-dev libopenal-dev libvorbis-dev libtheora-dev llvm-3.4 build-essential

First issue, the package "llvm-3.4" was not found so I had to search in the repository what is the Debian package that contain the same things.
It's something that could be done by looking at the package name and description, and if it's needed from a source code most of the time it must be a "dev" package.
Code:
sudo apt-cache search llvm | grep -e "^llvm" | sort

"llvm-13-dev" seems fine so I'll try to substitute it to the install chain
Code:
sudo apt-get install libsdl2-dev libsdl2-image-dev libopenal-dev libvorbis-dev libtheora-dev llvm-13-dev build-essential

All was fine, so I now can try to compile, using the command suggested by the "README.md"
Code:
make -j 8 OPT=true RELEASE=true

Second issue, a required program called "clang" was missing, so I'll install it, and try again the compile.
Code:
sudo apt install clang
make -j 8 OPT=true RELEASE=true

Third issue, I get some missing library files all called "isteam" ... after some research them are actually the STEAM SDK files that are not included in the source and must be downloaded from the STEAM WORKS site.
After accessing with the Steam user I got them and put them in the "./extern/steamworks" folder.
Then I try again to compile.
Code:
make -j 8 OPT=true RELEASE=true

Fourth issue, the STEAM SDK must be too recent and some of the function called from the source have a different number of arguments ... I don't know where to find old versions of the STEAM SDK, so I try to search if there's a way to exclude STEAM WORKSHOP functionality from the game ...
I have a look in "Makefile" and there is indeed a flag called "NO_STEAMWORKS", so here the new compile command.
Code:
make -j 8 OPT=true RELEASE=true NO_STEAMWORKS=true

Fifth issue, some reference to "translations.h" where not found in "main_loop.cpp" ... seems like a fault of using the "NO_STEAMWORKS" flag ...

Original "main_loop.cpp"
Code:
...
#ifdef USE_STEAMWORKS
#include "steam_ugc.h"
#include "steam_client.h"
#include "translations.h"
#endif
...

Modified "main_loop.cpp"
Code:
...
#ifdef USE_STEAMWORKS
#include "steam_ugc.h"
#include "steam_client.h"
#endif
#include "translations.h"
...

Again try the compile.
Code:
make -j 8 OPT=true RELEASE=true NO_STEAMWORKS=true

Sixth issue always with "translations.h" but this time in "main.cpp", so same correction as before

Original "main.cpp"
Code:
...
#ifdef USE_STEAMWORKS
#include "steam_base.h"
#include "steam_client.h"
#include "steam_user.h"
#include "translations.h"
#endif
...

Modified "main.cpp"
Code:
...
#ifdef USE_STEAMWORKS
#include "steam_base.h"
#include "steam_client.h"
#include "steam_user.h"
#endif
#include "translations.h"
...

Seventh issue, the source is searching for a "curl" package, I'll need to find it in the repo and add it.
Code:
sudo apt-cache search curl | grep dev
sudo apt install libcurlpp-dev

Compiling again.
Code:
make -j 8 OPT=true RELEASE=true NO_STEAMWORKS=true

Eight issue, it can't find something called "lssl" (the first "l" most of the time stands for "library"), again I'll need to search for it in the repo.
Code:
sudo apt-cache search ssl | grep dev | sort
sudo apt install libssl-dev
make -j 8 OPT=true RELEASE=true NO_STEAMWORKS=true

Ninth issue, a lot of undefined references to "MySteamInput" and "SteamAchievements", also some checks if it is running on the SteamDeck ...
I'll need to find if there are other FLAGS that I can use to disable all of these or if I'll need to modify the source directly ....

... CONTINUE ...
 
Last edited:
I like this approach, to show how it's done.
It might be implied, but are you doing all the work on the Pyra itself instead of a PC running Linux Bookworm?

Some suggestions that might help during development:
Search for more Steam related content in you files: grep -r "Steam\|MySteamInput\|SteamAchievements\|SteamDeck" .
Check if you use gcc or clang (you already installed it, so I assume you use it). You should be able to see it in your makefile as CC=gcc or clang. If you run gcc, builds could be faster if you use ccache: sudo apt install ccache
You run 8 compile jobs, which on a PC should be fine, but I'm not sure if the Pyra likes it. Using 2 or 4 might strain the CPU less. But maybe you can elaborate if 8 yields good results for you.
 
I'm working all on Pyra, also file editing.

As far as I see the compile always restart from the last error, so it require time only for newer things.

About Steam stuff seems like in many different part of the code the flag is not followed, so I'll have some corrections to do.
 
Back
Top