PCSX2 Documentation/Compiling on Linux: Difference between revisions
Jump to navigation
Jump to search
PCSX2 Documentation/Compiling on Linux (view source)
Revision as of 04:15, 13 January 2023
, 13 January 2023Massive rewrite to the page. Some information could use doublechecking.
(You should probably run make with -j or it'll be a lot slower.) |
(Massive rewrite to the page. Some information could use doublechecking.) |
||
Line 16: | Line 16: | ||
<source lang="bash"> | <source lang="bash"> | ||
$ cd /home/your/workspace | $ cd /home/your/workspace | ||
$ git clone | $ git clone git@github.com:PCSX2/pcsx2.git --recurse | ||
</source> | </source> | ||
Line 25: | Line 25: | ||
PCSX2 uses the cmake build system to create project files and other things for multiple platforms, and GCC or clang to compile on the linux platform. | PCSX2 uses the cmake build system to create project files and other things for multiple platforms, and GCC or clang to compile on the linux platform. | ||
Quick compile instructions: | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 41: | Line 41: | ||
And run bin/pcsx2-qt . | And run bin/pcsx2-qt . | ||
=== Compiling === | |||
To compile on linux, you will need git, cmake, and a compiler. For a compiler, gcc and clang are supported. If you are going to use the clang presets, also install lld as a linker. You'll also need make or ninja. Ninja is recommended, and required if using the clang presets. | |||
====Arch==== | ====Arch==== | ||
Run the following: | |||
<code># pacman -S cmake gcc</code> | |||
and optionally: | |||
<code># pacman -S clang lld ninja</code> | |||
(base-devel has gcc in it as well, and may be a good idea to install.) | |||
====Fedora==== | ====Fedora==== | ||
The required packages to compile PCSX2 can be installed with: | The required packages to compile PCSX2 can be installed with: | ||
<code># sudo yum install cmake g++</code> | |||
<code># | and optionally: | ||
<code># sudo yum install ninja-build lld clang</code> | |||
==Installing the Dependencies== | ==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. | 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.</br> | ||
If you don't have the following, it will use prebundled versions: | |||
<source lang="bash"> | <source lang="bash"> | ||
sdl2 >= 2.0.22 | |||
fmt >= 7.1.3 | |||
rapidyaml >= 0.4.0 | |||
zstd >= 1.4.5 | |||
libzip >= 1.8.0 | |||
</source> | </source> | ||
You have to have: | |||
<source lang="bash"> | |||
pcap | |||
liblzma | |||
libaio | |||
libsoundtouch | |||
qt6 | |||
</source> | |||
If your distribution has development versions of packages, you'll probably need those packages as well. With qt 6, we're probably talking something like:</br> | |||
'''Fedora:''' | |||
<source>yum install qt6-qtbase-devel qt6-qtbase-private-devel qt6-qttools-devel</source> | |||
<source> | '''OpenSuse:''' | ||
<source>sudo zypper install qt6-base-devel qt6-base-private-devel qt6-tools-devel qt6-linguist-devel</source> | |||
</source> | |||
'''Ubuntu:''' | |||
<source>apt install qt6-base-dev qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools</source> | |||
(All of those worked at one point, but need to be doublechecked.) | |||
==Compiling the Source== | |||
< | If you didn't already get pcsx2's source, run:</br> | ||
<code>$ git clone git@github.com:PCSX2/pcsx2.git --recurse</code> | |||
</ | |||
Now go into the pcsx2 directory: | |||
<source>$ cd ./pcsx2</source> | |||
If you forgot the "--recurse" part when cloning, run this command: | |||
<source>$ git submodule --init --recursive</source> | |||
Now, make a build directory: | |||
<source>$ mkdir -p ./build && cd ./build</source> | |||
Now, it is time to compile the source code! Easiest way to do that is with a preset.<br /> | |||
If you're using gcc/make: | |||
<source lang="bash">$ cmake --preset=gcc-release .. | |||
$ make -j <number of jobs. Say 4 or 6 if you aren't sure.></source> | |||
If you are using gcc & ninja: | |||
<source lang="bash">$ cmake --preset=gcc-release-ninja .. | |||
$ ninja</source> | |||
<source lang="bash"> | And if you are using clang with lld and ninja: | ||
- | <source lang="bash">$ cmake --preset=clang-release .. | ||
$ ninja</source> | |||
</source> | |||
Here's a full list, if you want a different preset: | |||
{| class="wikitable" | |||
|+ For reference, here is the current list of presets: | |||
|- | |||
! Name !! Description | |||
|- | |||
| ninja-multi || Generates ninja build files for debug/devel/and release builds for gcc. | |||
|- | |||
| gcc-debug || For making a debug build with gcc and make. | |||
|- | |||
| gcc-devel || For making a development build with gcc and make. | |||
|- | |||
| gcc-release || For making a release build with gcc and make. Does not have LTO. | |||
|- | |||
| gcc-debug-ninja || For making a debug build with gcc and ninja. (ninja builds faster then make.) | |||
|- | |||
| gcc-devel-ninja || For making a development build with gcc and ninja.(ninja builds faster then make.) | |||
|- | |||
| gcc-release-ninja || For making a release build with gcc and ninja. Does not have LTO. (ninja builds faster then make.) | |||
|- | |||
| clang-debug || For making a debug build with clang and ninja. (Fastest builds.) | |||
|- | |||
| clang-devel || For making a development build with clang and ninja. (Fastest builds.) | |||
|- | |||
| clang-release || For making a release build with clang and ninja. (This one has lto, so has the slowest build time.) | |||
|} | |||
If omit any of the libraries or headers specified above (or other, newer dependencies not included here), CMake will abort, your compiler may skip certain parts of the overall build or the linker may fail to link all the dependencies into the final PCSX2 executable. The output from any one of these tools should be able to tell the dependencies you're missing. | If omit any of the libraries or headers specified above (or other, newer dependencies not included here), CMake will abort, your compiler may skip certain parts of the overall build or the linker may fail to link all the dependencies into the final PCSX2 executable. The output from any one of these tools should be able to tell the dependencies you're missing. | ||
Line 155: | Line 156: | ||
==Running the Binary== | ==Running the Binary== | ||
This process may take several minutes. Once it has finished, you should be able to run the pcsx2 binary, which should've been output to the <code>bin/</code> directory. | This process may take several minutes. Once it has finished, you should be able to run the pcsx2 binary, which should've been output to the <code>build/bin/</code> directory. | ||
<source lang="bash"> | <source lang="bash">$ ./bin/pcsx2-qt</source> | ||
$ | |||
</source> | |||
==Additional external links== | ==Additional external, likely outdated links== | ||
* [http://forums.pcsx2.net/Thread-PCSX2-for-Debian-Ubuntu PCSX2 for Debian/Ubuntu] | * [http://forums.pcsx2.net/Thread-PCSX2-for-Debian-Ubuntu PCSX2 for Debian/Ubuntu] | ||
* [http://forums.pcsx2.net/Thread-PCSX2-for-Archlinux PCSX2 for Archlinux] | * [http://forums.pcsx2.net/Thread-PCSX2-for-Archlinux PCSX2 for Archlinux] |