Building the ports
doukutsu-rs has two official ports: one stable and one experimental.
Stable ports:
Android
Experimental ports:
Nintendo Switch (also referred as Horizon)
Stable ports are part of the upstream codebase, they are actively maintained and have official release builds. They can definitely be compiled and the compilation steps are known and most likely documented.
Experimental ports, on the other hand, typically don't have nightly builds, and their build algorithm may be undocumented or even broken. But the main reason for classifying a port as experimental is its instability.
Please note that this guide provides instructions for building ports on PC only. So first install Rust and clone the doukutsu-rs repository, as described in the previous section.
Android
1. Install Java
The Android port is written in Java, and the build tools require the Java Runtime, so you need to install JDK (Java Development Kit) to build this port. The minimum version of Java required to run Android development tools is Java 17.
Windows
On Windows you can install JDK following the official installation instructions provided by Oracle.
Linux
On Linux, JDK is usually installing from the repositories of the distribution you are using.
Arch-based distributions (Arch Linux, Manjaro, EndeavourOS, etc.):
Debian-based distributions (Debian, Ubuntu, Linux Mint, Pop!_OS, etc.):
2. Install Android Studio
Android Studio is the primary IDE for Android applications development, so in this guide we'll use it.
To install Android Studio, download it from the Android Developers portal. The minimum version required for building doukutsu-rs is Flamingo | 2022.2.1.
Windows
Download the installer and just install Android Studio. Then run it via a shortcut in the Start Menu or Desktop.
Linux
After downloading the archive, extract it to any location you want (in this example we will extract it into ~/.bin):
Then open a console (if you hasn't open it yet), enter into the extracted folder, and run bin/studio.shscript (give it execute permission, if it isn't set):
If Android Studio is started without any errors, you can move to the next step.
3. Install Rust targets
The Android builds of doukutsu-rs supports ARMv7, ARMv8, x86 and x86-64 architectures. To build it you need to install the appropriate Rust targets:
The build process also requires the cargo-ndk utility to be installed:
4. Install Android development kits
Launch Android Studio and on the welcome screen, press "More actions" and select "SDK Manager" from the drop-down menu. In the window that opens, tick "Show package details".

"Show Package Details" is checked.To understand what version of the development kits you need to install, look at the app/app/build.gradle file from the doukutsu-rs directory. In this build config compileSdkVersion property stores the API level, that you can use to install the required Platform SDK. buildToolsVersion and ndkVersion store the exact version of build tools and NDK, required for build. Also install CMake 3.18+ in the SDK Manager.
Install exactly the development kits version, that are specified in the build config. Otherwise the build can fail.
5. Configuring the project
When all dependencies are installed, we can finally open the project in Android Studio and configure it for building.
Open Android Studio, click "Open project" and select the app directory from the cloned doukutsu-rs repository.

When you open the project, in the bottom right corner will appear a notification asking you to install Android Gradle Plugin. Install it. If it will suggest to upgrade it, dismiss this notification.
After that, open build.gralde file from the app module and sync the project.

app module and sync the project.6. Build
If you lucky enough to not encounter errors or troubles in the previous steps, you can click a hammer on the top panel or press Ctrl+F9 to build the project. The output APK will be in the app/app/build/outputs/apk/debug folder.
By default the debug builds that support only ARMv8 (arm64) architecture will be generated. If you want to make a debug build for another architecture, you need to change the targets field in the cargoNdk.buildTypes.debug section (it is located at the end of build config).
7. (Optional) Signing the build
All builds require signing, unsigned builds cannot be installed (you will get an error, if you try to install an unsigned build). Debug builds are automatically signed by Android Studio's built-in keystore, but release builds requires manual configuration. To generate a signed release build, click "Build" -> "Generate Signed Bundle / APK". Choose "APK" and the keystore for signing, if it exists, or create one if it doesn't.
When you complete, Android Studio will automatically run the build with specified signing keystore. The generated build will be placed in app/app/build/outputs/apk/release.
Nintendo Switch (Horizon)
This port is experimental, which means that some features may be missing. This may be due to platform limitations or inactive maintenance. Also, for experimental port, build reproducibility and overall port functionality aren't guaranteed.
Building the Horizon port will produce ≈15 GiB of build artifacts if our patched Rust toolchain is fresh enough to use precompiled LLVM binaries downloaded from Rust CI servers. Otherwise, you may also need to compile the LLVM backend, which will produce an additional ≈20 GiB of build artifacts. Thus, you will need between 15 and 40 GiB of free space to build this port.
1. Install dependencies
Build process of the Horizon port depends primarily on the Switch homebrew toolchain provided by devkitPro. It uses the uam utility to compile shaders, deko3d as a graphics API, and many other tools to compile and package doukutsu-rs in the format that can be run on Switch.
devkitPro toolchains can be installed with the Arch Linux package manager pacman, also provided by devkitPro for macOS and other common Linux distros. On Widows they can be installed with a graphical installer. Setup instructions can be found on the devkitPro Wiki.
After installing pacman (or dkp-pacman), install the Switch development kit:
Don't forget to set environment variables containing the path to the development kit installation folder:
You also need the same development dependencies, as for the building the Linux port on a Linux system (1. Install the development dependencies), along with a few additional dependencies:
Arch-based distributions (Arch Linux, Manjaro, EndeavourOS, etc.)
Debian-based distributions (Debian, Ubuntu, Linux Mint, Pop!_OS, etc.)
Red Hat-based distributions (CentOS, Fedora, etc.)
2. Build Rust toolchain
We use a patched Rust toolchain to enable the std lib support for the Nintendo Switch target.
Clone this toolchain:
The target definition files aren't included in the toolchain, so copy them from the drshorizon folder of the cloned doukutsu-rs repository:
The build config is also not included in the toolchain, so copy the following contents into the bootstrap.toml file:
Now you can build the toolchain:
If the build completed successfully, install the compiled toolchain as rust-switch:
Do not remove or move the toolchain folder or build folder, because “installing” the custom toolchain literally means creating a symlink to the toolchain folder under some toolchain name. Therefore, if you delete this folder, you will no longer be able to use this toolchain to compile the Horizon port.
3. Build doukutsu-rs
Enter the drshorizon directory in the cloned doukutsu-rs repository and run the build script:
Output file drshorizon.nro will be placed in the target/aarch64-nintendo-switch/debug folder.
If you want to compile a release (optimized) build, run the build_release.sh script. The output file will be located in the target/aarch64-nintendo-switch/release folder.
Port feature completeness
Table legend:
✓ - implemented
* - partially implemented
❌ - unimplemented
Open user/data directory
✓
❌1
Portable user directory
❌
❌1
Horizon doesn't have a builtin file manager, and there are no sense to implement a portable user directory for this platform.
Last updated
Was this helpful?