HackerSM64 has a few dependencies that need to be installed on your Linux filesystem in order to compile.
New Ubuntu installations likely need their package lists updated to find new packages. To update package lists, run the following command:
sudo apt update
To install most of the required dependencies, run this command:
sudo apt install -y build-essential git libcapstone-dev pkgconf python3
Next, we will install the MIPS compiler, of which the instructions differ based on the version of Ubuntu being used. You can confirm which version you are on by running lsb_release -r in your terminal.
Ubuntu 24.04 and older
Simply run this command to install MIPS GCC:
sudo apt install -y gcc-mips-linux-gnu binutils-mips-linux-gnu
Ubuntu 25.10 or newer
You will need to install a custom MIPS toolchain to compile HackerSM64. Here are the applicable toolchain links you will need to reference below:
-
x86_64: https://github.com/aglab2/winn64libs/releases/download/2.0/n64libs-nix.zip
-
ARM64: https://github.com/aglab2/winn64libs/releases/download/2.0/n64libs-nix-arm64.zip
Download and extract the toolchain for your platform by running the commands below in your terminal (using the x86_64 toolchain as an example):
mkdir -p ~/Downloads # In case this folder doesn't already exist
cd ~/Downloads
wget https://github.com/aglab2/winn64libs/releases/download/2.0/n64libs-nix.zip # replace link with ARM64 toolchain if applicable
unzip ./n64libs-nix.zip # replace with name of ARM64 toolchain archive if applicable
Move the extracted toolchain and place it in /opt (assuming extracted zip is in Downloads folder):
sudo mv ~/Downloads/sdk /opt/n64-sdk
Add toolchain path to PATH in ~/.bashrc or other rc script for your shell interpreter:
echo PATH=\$PATH:/opt/n64-sdk/bin >> ~/.bashrc
Restart the terminal to apply ~/.bashrc changes. You should be able to see:
$ mips-n64-gcc --version
mips-n64-gcc (GCC) 14.3.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should be able to build HackerSM64 using make, once you have cloned it down (covered later in this tutorial):
$ make -j$(nproc)
...
0f81cb60eb00cdb535d874526e548355315641d3 build/us_n64/sm64.z64
Build succeeded.
==== Build Options ====
Version: us
Microcode: f3dzex
Console: n64
If you're using a Linux distro other than Ubuntu or Debian, these are the install strings you should use instead:
Fedora/CentOS/RHEL
sudo dnf updatesudo dnf install binutils-mips64-linux-gnu base-devel git capstone-devel pkgconf python3 gcc-mips64-linux-gnu
Arch/Manjaro/Steam Deck
We have an unofficial PKGBUILD now!
- Use a quicker build script to both install dependencies and build the game!
- Baseroms must be placed in your home folder (
/home/(username)/or~/) - Download the PKGBUILD and place in a new folder
- Run
makepkg -sin that folder - Your repository will live in
(that folder)/src/HackerSM64-develop-2.1.0for you to play around with (or move to an easier location)
- Baseroms must be placed in your home folder (
Grab Dependencies Manually
sudo pacman -Syusudo pacman -S git make capstone gcc pkgconf- You will also need some packages from the AUR:
- First, get
mips64-elf-gcc-stage1 - Next, install
mips64-elf-binutilsandmips64-elf-gcc - If you do not want to use AUR, follow the same steps as Ubuntu to install a custom toolchain.
- First, get
Docker setup
If you are using a very special distro that does not work with regular Linux packages (macOS for example) or you just want to have a 1 click solution at the expense of extra disk space (roughly 600MB requires for the image), you can use prebuilt Docker container.
In your HackerSM64 directory perform
docker pull aglab2/n64chain:latest
docker run --rm -v ${PWD}:/workspace aglab2/n64chain:latest make -j8
Note that any build command in the tutorial needs to be now prefixed with docker run --rm -v ${PWD}:/workspace aglab2/n64chain:latest so if you would want to perform clean, you will need to run
docker run --rm -v ${PWD}:/workspace aglab2/n64chain:latest make clean
Note that while "git" is present in the docker container, you should use host "git" instance instead because SSH keys do not get propagated inside the container.
| Previous Mounting WSL to Drive |
Installing Dependencies Installing HackerSM64 |
Next Setting up a Hack Repository |