How to build Super Mario 64 natively on Linux

Super Mario needs no presentations: it is one of the most beloved video games characters. Super Mario 64 was originally released for the Nintendo64 console in 1996, and represented the first 3D episode of the Mario franchise. Thanks to a github project, which achieved the full decompilation of the game, it is now possible to build a native Linux port and play it without the need of a Nintendo64 emulator. In order to compile the port, an original, and legally obtained “.z64” rom of the game is needed.

In this tutorial we see how to compile and launch the Super Mario 64 Linux port on some of the most used distributions.

In this tutorial you will learn:

  • How to install the software needed to compile Super Mario 64 on the most used Linux distributions
  • How to build and launch the port
How to build Super Mario 64 natively on Linux
How to build Super Mario 64 natively on Linux
Software requirements and conventions used
Category Requirements, Conventions or Software Version Used
System Fedora, Ubuntu or Archlinux
Software Build dependencies specified in the article
Other None
Conventions # – requires given linux-commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux-commands to be executed as a regular non-privileged user

Installing the build dependencies

The first thing we need to do in order to build the Super Mario 64 Linux port, is to install the build-dependencies. The packages we need to install vary depending on the distribution we are using. On Fedora, we can install the dependencies by running the following command:

$ sudo dnf install git \
  libXrandr-devel \
  alsa-lib-devel \
  pulseaudio-libs-devel \
  python3 \
  make \
  gcc \
  g++ \
  libusb-devel \
  SDL2-devel \
  util-linux



On Ubuntu, instead, we can use apt-get to acquire the needed software:

$ sudo apt-get update && sudo apt-get install git \
  build-essential \
  libusb-1.0-0-dev \
  libsdl2-dev \
  libc6-dev \
  bsdmainutils \
  python3

To build the game on Archlinux we must install the following packages with pacman:

$ sudo pacman -Sy git \
  base-devel \
  python3 \
  sdl2 \
  xorg-xrandr \
  alsa-lib \
  pulseaudio

Cloning the repository

Once we installed the needed dependencies, we can clone the github repository which hosts the code. The command below clones the remote repository inside the sm64-port directory:

$ git clone https://github.com/sm64-port/sm64-port



We now need to move the legally obtained “.z64” rom of Super Mario 64 inside the repo directory, renaming it as baserom.{version}.z64 where “{version}” is the regional version of the game: “us”, “eu” or “jp”. Here we suppose the “us” version of the rom to be in our HOME directory:

$ mv ~/SuperMario64.z64 sm64-port/baserom.us.z64

Building the game

As a next step, we move inside repository directory and start building the game using make, optionally providing the -j option, which can be used to specify how many jobs should run simultaneously:

$ cd sm64-port && make -j4

As soon as we launch the command, the build process should start, just wait for it to finish:

==== Build Options ====
Version: us
Microcode: f3dex2e
Target: sm64.us
Compare ROM: no
Build Matching: no
=======================
Building tools...
Building ROM...
Preprocessing level make rules: levels/level_rules.mk -> build/us_pc/level_rules.mk
==== Build Options ====
Version: us
Microcode: f3dex2e
Target: sm64.us
Compare ROM: no
Build Matching: no
=======================
Building tools...
Building ROM...



If the process terminates without errors, we should find the game executable created in the build/{version}_pc directory inside the repository. In this case, to launch it, we can simply execute:

$ ./build/us_pc/sm64.us

If everything goes as expected we should see the game in all its glory:

The Super Mario 64 Linux port up and running!
The Super Mario 64 Linux port up and running!

Conclusions

In this tutorial we saw how to build a native port of Super Mario 64 on Linux: we saw how to install the needed dependencies, how to clone the repository hosting the code, and how to actually perform the build. The build process described in this article requires an existing “.z64” Super Mario 64 rom to retrieve the game assets: you should use it only if you are able to obtain it legally.



Comments and Discussions
Linux Forum