Building SRB2 Kart for Linux

1- First install the dependencies

Assuming Ubuntu. For other distros find the equivalent dependencies
Open up a terminal and type

sudo apt-get install build-essential git p7zip-full p7zip-rar nasm libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libopenmpt-dev libcurl4-openssl-dev

2- Get the source code

vanilla source code:

https://git.do.srb2.org/KartKrew/Kart-Public.git

moe mansion:

https://gitlab.com/himie/kart-public.git

Moe Mansion is for playing at 60fps and all the latest probably unstable features. Recommended for client if you’re playing the game on linux.

Vanilla is the same code that kart krew released for 1.3. Recommended for a server since it doesn’t need all the extra features in moe.

Clone the code with git from the moe repository this will get the moe mansion srb2kart 1.3 code (change the url to vanilla if you’re building for a server or don’t want moe mansion)

DO NOT use moe mansion to host a dedicated server. It should only be used as a client. Use vanilla if you’re hosting a dedicated server. There’s some reports that it works fine now as dedicated. If it’s not the case let me know on discord.

git clone https://gitlab.com/himie/kart-public.git

In the terminal move to the directory you just cloned. Make sure to match the name of the repo that you cloned. Moe mansion is all lower case while vanilla uses upper case Kart-Public

cd kart-public

In the future if you want to update your installation you can update the source code by pulling from the repository with git

git pull

3- Compile the source code

This is the most basic line you can compile with. Add any extras as needed.

make -C src/ LINUX64=1
  • Change LINUX64=1 to LINUX=1 if doing 32-bit
  • Add NONX86=1 if compiling on ARM like an rpi
  • Add NOUPX=1 to get rid of the upx warning at the end of compiling
  • If you still have problems with GME you can disable it by adding NOGME=1
  • Add NOOBJDUMP=1 to speedup linking time
  • Enable discord rich presence support by adding HAVE_DISCORDRPC=1
    • To compile with discord you need to download the discord rpc .zip from here
    • Copy the files from discord-rpc/linux-dynamic/
        • discord_register.h and discord_rpc.h go into /usr/local/include/
        • libdiscord-rpc.so goes into /usr/local/lib/
  • If you are on an older distro (Ubuntu 20.04 or lower, Debian 10 or lower)
    • Add LIBGME_CFLAGS= LIBGME_LDFLAGS=-lgme  before “make” to fix libgme errors
    • Your compile line should end up looking like
    • LIBGME_CFLAGS= LIBGME_LDFLAGS=-lgme make -C src/ LINUX64=1
  • If you are on an newer distro (Ubuntu 20.10+, Debian 11+, Arch)
    • Install pkg-config with sudo apt install pkg-config it will deal with fixing libgme automatically if you have it installed

In the end your compile line should look something like this (this is what I use)

make -C src/ LINUX64=1 NOUPX=1 NOOBJDUMP=1

After waiting for a while the binary will be compiled to bin/Linux64/Release/lsdl2srb2kart

As a good practice every time you want to compile again you need to clean the source folder to avoid getting weird errors. This is mostly necessary when switching branches but it doesn’t hurt to do it every time you compile. To clean simply add “clean” at the end of your compile line. You can quickly go back to what you typed before by pressing the up arrow key and adding clean at the end. Then to the same but with “cleandep”.

For example with my compile line above I would clean like this:

make -C src/ LINUX64=1 NOUPX=1 NOOBJDUMP=1 clean
make -C src/ LINUX64=1 NOUPX=1 NOOBJDUMP=1 cleandep

And then remove the clean to compile again

make -C src/ LINUX64=1 NOUPX=1 NOOBJDUMP=1

4- Install the binary

What I like to do is move this binary to /usr/local/bin for easy access
While still being in Kart-Public folder in the terminal:

sudo install -Dm755 bin/Linux64/Release/lsdl2srb2kart /usr/local/bin/srb2kart

Also copy the icon

sudo install -Dm644 srb2.png /usr/local/share/pixmaps/srb2kart.png

5- Obtain the assets

Next you’ll need to obtain the assets for srb2 kart.
You can get them with the windows release https://github.com/STJr/Kart-Public/releases/download/v1.3/srb2kart-v13-Installer.exe

If you are running a desktop on linux you can download the installer.exe and open it as an archive and extract all the .kart .srb mdls.dat and mdls/ files
They should go in a folder called .srb2kart inside your home folder

You can also do it via the terminal:

Create the .srb2kart directory with mkdir

mkdir ~/.srb2kart

Move into it with cd command (change directory)

cd ~/.srb2kart

Get the Installer

wget https://github.com/STJr/Kart-Public/releases/download/v1.3/srb2kart-v13-Installer.exe

Extract only the files we nee

7z x srb2kart-v13-Installer.exe "*.kart" "*.srb" "mdls.dat" "mdls/*"

Delete the installer since it’s no longer needed

rm srb2kart-v13-Installer.exe

6- Run the game

Now you can run the game by typing in the terminal

srb2kart -opengl

7- Add shortcuts to your applications menu

Will use the .desktop files provided by SteelTitanium in the AUR

Type into the terminal:

sudo wget -O /usr/local/share/applications/srb2kart-opengl.desktop https://aur.archlinux.org/cgit/aur.git/plain/srb2kart-opengl.desktop?h=srb2kart
sudo wget -O /usr/local/share/applications/srb2kart.desktop https://aur.archlinux.org/cgit/aur.git/plain/srb2kart.desktop?h=srb2kart

If the /usr/local/share/applications folder doesn’t exist create it with mkdir

Now srb2kart should appear in your applications menu.

Running with OpenGL lets you use models, better performance, among other things and it’s recommended.

Alternatively, you can do a rootless install, if you want to keep everything inside your home folder or are on a computer where you can’t access root (admin access).
Copy lsdl2srb2kart into ~/.local/bin, copy the .desktop files into ~/.local/share/applications, copy the icon into ~/.local/share/pixmaps

If everything on the guide worked fine you don’t have to do this.

Credits

Thanks to DudeValenzetti, MajorGnuisance, and Ashnal for helping in figuring out compiling and linux fu to make this guide noob friendly.

This entry was posted in Linux and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *