-
Notifications
You must be signed in to change notification settings - Fork 141
Installing libdragon
Installing libdragon requires two things:
- Installing the toolchain (that is the C compiler that can generate MIPS binary)
- Compiling libdragon itself (the library), its tools, and its examples
Installing the toolchain can be fast (if you get a binary version) or slow (if you decide to recompile it yourself), but you only need to do this once. There is never a real need to upgrade the toolchain. Once you install it once, it will likely be fine for years to come.
Viceversa, compiling libdragon and its tools takes one minute or so, and you can do this as many times as you want, including upgrading libdragon every day (especially if you follow the unstable branch). You can upgrade libdragon freely and even have ten different versions on your computer. But you still just need one toolchain.
This is the recommended installation procedure as it is the fastest. You will download a precompiled toolchain and install it on your system. There are a few different options, also depending on the operating system you work on.
Supported OS: Windows, Linux, macOS x86/arm
This option uses Docker as a way to quickly ship a prebuilt toolchain on all operating systems. It does not require you to explicitly learn Docker: you will interact with a libdragon CLI and Docker will be used under the hood.
See the libdragon CLI to quickly get libdragon up and running. Basically:
-
Make sure that you have Docker installed correctly (on Windows and Mac, use Docker Desktop). You can run
docker system infoto check that it is working correctly. -
Install the the libdragon CLI. You have two options:
a. Download the pre-built binary, and copy it into some directory which is part of your system PATH. b. Or, if you have
npminstalled (at least verstion 14), runnpm install -g libdragon. -
Run
libdragon initto create a skeleton project. The first time ever you run this, it will also download the libdragon Docker image that contains the toolchain. It will also download libdragon itself and builds it for you. -
Run
libdragon maketo compile a build a ROM
If you want, you can also compile and run one of the examples that will be found in libdragon/examples in the skeleton project.
Note for Apple Silicon users: we ship and update the docker container image for both x86-64 and arm64, so this option works on Apple Silicon machines too.
Supported OS: Windows (requires WSL2 or msys2), Linux
Download the pre-built toolchain, available on GitHub as a release in this repository. There is a ZIP file for Windows, plus a .deb and a .rpm file for Linux. Additional instructions:
Windows users with WSL2:
- make sure the package manager is up to date:
sudo apt-get update. - install prerequisites:
sudo apt install build-essential libpng-dev - download the toolchain in .deb format and install it via
sudo apt install gcc-toolchain-mips64-libdragon-x86_64.deb - Get a copy of libdragon from GitHub (via git or how you prefer) and unpack it somewhere, then run
./build.shto build and install libdragon.
Windows users with msys2:
- download the native Windows toolchain in ZIP format and unpack it somewhere (eg:
c:\n64-toolchain). Avoid paths with spaces. - Open the Start menu, search "Environment" to open the Control Panel in the Environment Variables window. Create a new variable with name
N64_INSTand set as value the path to the folder where you unpacked the toolchain (eg:c:\n64-toolchain). - Get a copy of libdragon from GitHub (via git or how you prefer) and unpack it somewhere. Open a msys2 terminal there and run
./build.shto build and install libdragon.
Linux users:
- download either the toolchain in .deb format or toolchain in .rpm format. Install it as usual for your operating system. The packages will install the toolchain into
/opt/libdragon, and will also create a script file in/etc/profile.dto automatically configure for you the environment variable$N64_INST=/opt/libdragon - Open a new terminal after installation. The shell should have run the script file and configured the system. Try
echo $N64_INSTto confirm the installation was successful. - Download libdragon (eg:
git clone) and run./build.shto compile and install libdragon (it will be installed again under/opt/libdragon). The./build.shwill ask for sudo when needed to install into/opt/libdragon.
Supported OS: Windows via WSL2 or msys2, Linux, macOS x86/arm
These instructions work for Linux, macOS (Intel / Apple Silicon) and Windows with WSL2 or msys2. WSL1 users must upgrade to WSL2 first.
- Export the environment variable N64_INST to the path where you want your toolchain to be installed. For instance:
export N64_INST=/opt/libdragonorexport N64_INST=/usr/local. - If you are on macOS, make sure homebrew is installed.
- Install the following packages that are needed: these are the Debian names, but they should be similar on all systems:
build-essential(GCC, binutils, make, autotools, etc.),texinfo. - Make sure you have at least 7 GB of disk space available (notice that after build, only about 300 MB will be used, but during build a lot of space is required).
- Enter the
toolsdirectory and Run./build-toolchain.sh, let it build and install the toolchain. The process will take a while depending on your computer (1 hour is not unexpected). - Install
libpng-devif not already installed. - Make sure that you still have the
N64_INSTvariable pointing to the correct directory where the toolchain was installed (echo $N64_INST). - Run
./build.shat the top-level. This will install libdragon, its tools, and also build all examples.
You are now ready to run the examples on your N64 or emulator.
Once you are sure everything is fine, you can delete the tools/toolchain/
directory, where the toolchain was built. This will free around 6 GB of space.
You will only need the installed binaries in the N64_INST from now on.