PCSX2 Documentation/Compiling on Linux
The following is a guide on how to obtain and compile the PCSX2 source code on the Linux platform.
For a more in-depth guide on the PCSX2 build process, please refer to this guide here:
Obtaining the Source Code
PCSX2 is hosted on GitHub, a website where people can contribute to each others' programming projects using the Git version control software. GitHub is essentially just a showcase for your projects, to actually work on them you need to download and install Git itself.
- Arch Linux:
# pacman -S git
# apt-get install git
# dnf install git
Next you are going to want to create a directory on your machine for the PCSX2 code to live in. For this example, let's say the directory you create is /home/you/workspace. You are going to want clone the remote PCSX2 repository like so:
$ cd /home/you/workspace $ git clone https://github.com/PCSX2/pcsx2.git
You are now making a copy of the remote repository into your own directory.
Setting up the Build System
PCSX2 uses the cmake build system to create project files and other things for multiple platforms, and GCC to compile on the linux platform.
32-bit compile on 64-bit machines
If you are running 64-bit Arch Linux, you are going to need to enable access to the multilib repository, so you can obtain 32-bit libraries. You can do this by uncommenting the following lines in
[Multilib] Include = /etc/pacman.d/mirrorlist
Then, just run the following:
# pacman -S cmake gcc
It is important to note that you do not need to install
gcc-c++.i686. Installing this package could result in some packages being downgraded, resulting in a broken g++ compiler.
The required packages to compile PCSX2 can be installed with:
# dnf install gcc-g++ glibc-devel.i686 libstdc++-devel.i686
Installing the Dependencies
PCSX2 relies on a number of 3rd party software libraries, so you are going to need to obtain those before you can compile the source code. Here's a non-exhaustive list of these dependencies.
lib32-alsa-lib lib32-bzip2 lib32-libjpeg lib32-glew lib32-nvidia-cg-toolkit lib32-portaudio lib32-sdl lib32-libaio lib32-wxgtk3 lib32-soundtouch lib32-libpcap lib32-libsamplerate sparsehash fmt
When generating the build configuration, CMake will first attempt to use pre-bundled versions of some of these packages to ensure PCSX2 is built against the most suitable version of its dependencies. Please note you may still need to install 32-bit versions of some of these libraries yourself.
To obtain all the required dependencies for 32-bit compile on Fedora, reference their
i686 architecture version, like so:
# dnf install alsa-lib-devel.i686 libpcap-devel.i686 libxml2-devel.i686 freetype-devel.i686 \ xz-devel.i686 mesa-libGL-devel.i686 libpng-devel.i686 libaio-devel.i686 systemd-devel.i686 \ portaudio-devel.i686 soundtouch-devel.i686 SDL2-devel.i686 harfbuzz-devel.i686 wxGTK3-devel.i686 \ gtk3.i686 gtk3-devel.i686 glib2-devel.i686 libsamplerate.i686 libsamplerate-devel.i686 gdk-pixbuf2-devel.i686
Note: this list of dependencies was last verified on a Fedora 33 (x86_64) installation.
Compiling the Source
Note: On Arch Linux, you may need to explicitly specify to cmake where to find the config executables. You can do that by adding these flags into the build script:
Now that we have installed all external libraries, it is time to compile the source code! To do that, we are going to run a shell script which automates the entire process.
$ cd /home/you/workspace/pcsx2 $ sh build.sh
Running the Binary
This process may take several minutes. Once it has finished, you should be able to run the pcsx2 binary: