If you wish to build the toolchain yourself, beware that this process can get pretty tedious unless you have a powerful enough computer with plenty of threads to spare. A system with at least 4 to 8 total threads or more is recommended. You may have better success building the toolchain in ArchLinux especially if you want to build the most recent versions of GCC. Debian Buster however, may have about the same chance of success in building as using ArchLinux. It is recommended to stick with GCC 7.4.0 and Binutils 2.31 as this is the version PSn00bSDK is most tested with. Though generally, it doesn't hurt to try out newer versions and has been known to work flawlessly without issue. These instructions are only for Linux, though they can be adapted for building in Windows using MSys2 or Cygwin64. Beware that libgcc cannot be built under Windows as the libgcc build process depends on symlinks which is not supported by the operating system and is not wrapped by Msys2 and Cygwin64. The only workaround is to first build GCC in Linux then copy the libgcc.a library from it to the Windows build. Make sure the following packages are installed prior to building: * make * texinfo * mpfr (development libs, if your distro offers it in a separate package) * isl (development libs, if your distro offers it in a separate package) * gmp (development libs, if your distro offers it in a separate package) * mpc (development libs, if your distro offers it in a separate package) * build-essential or build-essentials, if you don't have GCC installed yet. Building binutils: Binutils must be built first as GCC depends on binutils built for the same target architecture. In this case, building binutils and GCC to target mipsel-unknown-elf. * Download binutils source files at ftp://ftp.gnu.org. Choose a version you wish to use with PSn00bSDK. The reference version that PSn00bSDK is tested with most is 2.31. * Extract the contents of the archive, preferably in a directory named gcc. * Create a directory named binutils-build inside the gcc directory. Do not create it inside the binutils directory with the source files. * Enter the binutils-build directory and configure binutils from there with the following command line: ../binutils-/configure --prefix=/usr/local/mipsel-unknown-elf \ --target=mipsel-unknown-elf --with-float=soft Replace with the version of binutils you wish to use. You may also want to change the prefix argument to a path you prefer to have the toolchain installed to (ie. somewhere within your home directory so you wouldn't need root privileges to install). * Run `make -j 4` to compile binutils (-j specifies how many simultaneous jobs to spawn at once, set it equal to the number of cores/threads your system has available to speed up compiling). * Run `make install-strip` to install binutils to the path specified by the --prefix argument (root privileges are required if the prefix points to /usr/local). Building gcc: With binutils built it should be possible to build the GCC toolchain. Since GCC is considerably larger than binutils, compile time is going to be much longer so it's going to take a longer while to build this. * Download gcc source files at ftp://ftp.gnu.org and choose the version you wish to use with PSn00bSDK. The reference version that PSn00bSDK is tested with most is 7.4.0. * Extract it to the same gcc directory you extracted binutils in. * Create a directory named gcc-build inside the gcc directory. * Enter the gcc-build directory and configure gcc from there with the following command line: ../gcc-/configure --disable-nls --disable-libada --disable-libssp \ --disable-libquadmath --disable-libstdc++-v3 --target=mipsel-unknown-elf \ --prefix=/usr/local/mipsel-unknown-elf --with-float=soft \ --enable-languages=c,c++ --with-gnu-as --with-gnu-ld Replace with the version of gcc you downloaded. The prefix path must match to what you've specified for binutils earlier, if you've decided to use a different prefix path for binutils. When building under Windows you must additionally specify --disable-libgcc, as libgcc cannot be built under Windows as it needs symlinks which are not supported by the operating system. * Run make in the same manner you built binutils with. * Run `make install-strip` to install gcc to the path specified by --prefix (root privileges are required if the prefix points to /usr/local). * Add a path to the bin directory of the toolchain into your PATH environment variable by adding the following line in your .bashrc or .bash_profile file: export PATH=$PATH:/usr/local/mipsel-unknown-elf/bin Under Windows, you'll have to add the path to the PATH environment variable through System Properties. Note regarding C++ support: C++ support in PSn00bSDK only goes as far as basic classes, namespaces and the ability to dynamically create and delete class objects at any point of the program. The required dependencies are supplied by libc of libpsn00b. Standard C++ libraries are not implemented and likely never going to be implemented due to bloat concerns that it may introduce. Besides, the official SDK lacks full C++ support as well. If you're trying to compile with C++ code and you get a linker error about undefined vtables, try specifying --fno-rtti to the g++ command line. ----------------------------------------------------------------------------- Updating the ldscript (NO LONGER REQUIRED as PSn00bSDK now ships with its own linker scripts, the section below is only kept for reference): The following changes used to be required in order for basic C++ functionality to work in older PSn00bSDK versions. The changes define the constructor and deconstructor sections which are required for the relevant support functions in PSn00bSDK's libc library to be linked properly for C++. * Go to mipsel-unknown-elf/lib/ldscripts in the toolchain directory. * Open elf32elmip.x in any text editor. * Locate the .text definition (with the {} brackets) and add the following inside the bracket block: __CTOR_LIST__ = .; ___CTOR_LIST__ = .; LONG (((__CTOR_END__ - __CTOR_LIST__) / 4) - 2) KEEP (*(SORT (.ctors.*))) KEEP (*(.ctors)) LONG (0x00000000) __CTOR_END__ = .; . = ALIGN (0x10); __DTOR_LIST__ = .; ___DTOR_LIST__ = .; LONG (((__DTOR_END__ - __DTOR_LIST__) / 4) - 2) KEEP (*(SORT (.dtors.*))) KEEP (*(.dtors)) LONG (0x00000000) __DTOR_END__ = .; . = ALIGN (0x10); * Save script changes. Since there's no known way (at least to me -Lameguy64) to configure GCC such that it uses the modified ldscript as the default, you must specify the modified script during the linking stage of your projects with the -T argument, when invoking mipsel-unknown-elf-ld. Alternatively, you can make a copy of the ldscript file and modify it within your project directory. This is especially useful if your project uses code overlays.