Merry christmas! I decided that I wanted to play Dwarf Fortress but had no available x86 based machines. I'm gonna show you how I got it to run under Raspberry Pi OS!
It's no small feat running DF on an ARM host.
This guide is gonna presume you're running a 32-bit Raspberry Pi OS Lite image like I am.
Getting DF to work relies on a lot of stuff.
This command will fetch all the required dependencies for DF and Box86
apt-get install libsdl1.2debian libsdl-image1.2 libsdl-ttf2.0-0 libopenal1 libsndfile1 libncursesw5 libglu1-mesa libgtk2.0 cmake
The DF wiki suggests all but the last three dependencies. Since RPiOS doesn't ship with LibGLU or LibGTK, we need to install those.
CMake is required for the next step.
If you thought I would just say "download a binary and you're on your way", no it's not that easy.
You need an x86 to ARM translator: box86.
If you're using a 64-bit environment (when RPi releases the 64-bit edition or you're using Ubuntu/Manjaro), compile box64 instead.
You'll need the source code to build:
git clone https://github.com/ptitSeb/box86.git
Go into the directory and make a directory called build, go into that directory.
Now use cmake:
cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
And build and install (use -j2 to make stuff fasterer!):
make -j2 sudo make install sudo systemctl restart systemd-binfmt
Building takes a good 15-20 minutes to complete.
Now is the easy step. Download Dwarf Fortress.
Go to the Dwarf Fortress site: if you use the 64-bit version download the Linux file but if you need the 32-bit version it is available under "All versions"
You will need to then extract DF like so:
bzip -d df_XX_YY_linux32.tar.bz2 tar -xvf df_XX_YY_linux32.tar
There will now be a df_linux folder. Enter it.
You must link some libraries for it to work:
ln -s /usr/lib/libopenal.so.1 libs/libopenal.so ln -s /usr/lib/libsndfile.so.1 libs/libsndfile.so
If you have a graphical UI setup, type ./df and off you go!
For those without a X11/Wayland server setup:
Press Control and backslash together and type
Press enter and then type
This switches DF to text mode, now you can run ./df and enjoy DF from the terminal!
Keep the world relatively simple by setting most settings to low or very low.
Have the world size be below Medium. I had all settings set to Medium and my Pi 3B froze.
You may get better performance on a Pi3B+ or Pi4 but I haven't tested.
Remember this is unofficial and YMMV.