tutorial:toolchain_setup

Choosing A Toolchain

There are currently 3 toolchains for PSP development in C/C++, Rust, and Zig. Each one is slightly different, and has a different process to set up. Below are instructions for each, and on popular platforms. Nothing prevents you from having all 3 at once, so feel free to experiment!

Windows

To install the toolchain on Windows XP and higher, you can go download the installer here.

Once you have installed the PSPSDK, which should be located at C:/pspsdk. We need to add this to our path by going to Windows Icon → Search → Set Environmental Variables → System Environmental Variables → Set Path to include C:/pspsdk/bin. For modern Windows, this is rather simple - you just need to add a new entry in the list. On older versions, you need to add a semi-colon to the end of the path, then add the direct location.

Congratulations! You now have a working installation!

Unix-Based OS

You'll want to make sure you've installed developer tools including git.

To get the toolchain, you will need to run

git clone https://github.com/pspdev/pspdev.git

If you use Linux, use the prepare script according to your distro. For example, on Ubuntu/Debian you can use the ./prepare-debian-ubuntu.sh to get all dependencies (Also make sure to set your terminal to avoid using dash, as it will create issues)

If you're on Mac OS, you'll need Ports or Homebrew to develop. After that, you can use the ./prepare-mac-os.sh in order to get all of your dependencies.

If you're not on either, you will need the following packages:

autoconf, automake, bison, bzip2, cmake, doxygen, diffutils, flex,
 g++/gcc-c++, gcc, git, gzip, libarchive, libcurl, libelf, libgpgme,
 libssl, libtool, libusb-dev, m4, make, ncurses, patch, pkg-config,
 python3, readline, subversion, tar, tcl, texinfo, unzip, wget, xz-utils

To setup your working directory:

export PSPDEV=/usr/local/pspdev
sudo mkdir -p $PSPDEV
sudo chown -R $USER: $PSPDEV

And in your login script:

export PSPDEV=/usr/local/pspdev
export PATH=$PATH:$PSPDEV/bin

Once that's done you'll need to initiate compilation with:

sudo ./build-all.sh

After installation, you need to add your toolchain to path with

export PATH=$PATH:/usr/local/pspdev/bin

or use the login script as described earlier.

Congratulations! You now have a working installation!

To install Rust on your computer, you'll need to head to the official Rust installer, rustup. Follow the instructions and install Rust. If you're on Windows, you'll need Visual Studio C++ Build Tools.

After you've finished that, you'll need to hop into your favorite terminal (or refresh your terminal instance) and set your toolchain to nightly and add the rust-src component. Then, we'll install cargo-psp.

rustup default nightly
rustup component add rust-src
cargo install cargo-psp

This will set your default Rust toolchain to be nightly. You can also do a per-project override with the following commands:

cargo new my-psp-app
cd my-psp-app
rustup override set nightly

Finally, add the psp crate to your Cargo.toml.

Now you've got a working PSP Toolchain in Rust!

For working with Zig-PSP, all you need is the v0.8.1 of the Zig compiler installed. You can find the downloads here here.

Once you've installed Zig, and it is in your path (see above), make sure you also have git installed for general repository work. You'll need to make a copy of the GitHub template with the following command:

git clone https://github.com/zPSP-Dev/Zig-PSP-Template.git --recursive

And there you have it! You should have everything required to get started with Zig.

  • tutorial/toolchain_setup.txt
  • Last modified: 2022/09/26 23:12
  • by iridescence