Updated 10 Building on Linux (markdown)

Connor McLaughlin 2023-12-31 13:27:35 +10:00
parent 16266607fa
commit 43955e4c1b
1 changed files with 2 additions and 101 deletions

@ -38,8 +38,6 @@ Optionally, you can build with:
Use one of the cmake presets:
`mkdir build && cd build && cmake --preset=<preset> ..` and then either `make -j <cores>` or `ninja`, depending on the preset.
For gcc and make, use `gcc-debug`, `gcc-devel`, or `gcc-release`.
For gcc and ninja, use `gcc-debug-ninja`, `gcc-devel-ninja`, or `gcc-release-ninja`.
For clang, lld, and ninja, use `clang-debug`, `clang-devel`, or `clang-release`. This is currently the only lto preset.
#### Expert mode: CMake build parameters
@ -49,26 +47,6 @@ Basic parameters:
- `Release`: Best in speed, but provides little or no debug/crash info.
- `Devel`: Adds detailed trace logging abilities, but still lacks debug/crash info.
- `Debug`: No compiler optimizations. Very good for debug/crash info but also very slow.
- Follow XDG standard : `-DUSE_LEGACY_USER_DIRECTORY=TRUE`
Expert parameters (not supported, the best is to use the default options):
- Tune C flags : `-DUSER_CMAKE_C_FLAGS:STRING="cflags"`
- Tune C++ flags : `-DUSER_CMAKE_CXX_FLAGS:STRING="cxxflags"`
- Tune linker flags : `-DUSER_CMAKE_LD_FLAGS:STRING="ldflags"`
Expert debugging parameters (typical developer-only option):
- Build GS replayer: `-DBUILD_REPLAY_LOADERS=TRUE`
- Use Address Sanitizer: `-DUSE_ASAN=TRUE`
Expert options for package creation:
- Enable package mode : follow the FHS for distribution `-DPACKAGE_MODE=TRUE`
- GameDB install path in package mode : `-DGAMEINDEX_DIR="/usr/share/games/pcsx2"`
- Documentation install path in package mode : `-DDOC_DIR="/usr/share/doc/pcsx2"`
- GLSL shader install directory : `-DGLSL_SHADER_DIR="/usr/share/games/pcsx2"`
- Disable AVX: `-DDISABLE_ADVANCE_SIMD=TRUE`
- Enable/disable the stipping : `-DCMAKE_BUILD_STRIP=TRUE|FALSE`
- `TRUE`: Remove debugging information.
- `FALSE`: Keep symbols. Better for debug. (recommended since it should not have any impact on speed)
### Running CMake to generate the makefile:
@ -148,89 +126,12 @@ Not all distributions and configurations were tested. In case you encounter a CM
It can be helpful to run PCSX2 under [GDB](https://www.gnu.org/software/gdb/) in order to set breakpoints and debug crashes.
To enable debugging with symbol names:
- Run `build.sh` with the `--debug` option (not `--devel` or `--release`).
- Ensure the `--strip` option is not enabled.
- Consider enabling other `build.sh` flags as described above if they are useful for your debugging.
To enable debugging with symbol names, use `-DCMAKE_BUILD_TYPE=Debug`.
The built executable can then be debugged using `gdb ./bin/PCSX2`. Make sure you configure your plugin paths correctly within the PCSX2 GUI if you're making changes to plugins!
The built executable can then be debugged using `gdb ./bin/pcsx2-qt`. You will need to disable segfault catching with `process handle SIGSEGV nostop noprint`.
### Segmentation Faults
Segmentation faults (`SIGSEGV`) are [expected](https://github.com/PCSX2/pcsx2/issues/1806#issuecomment-278268282) when running recompiled code such as a game in PCSX2. When a segmentation fault occurs, use `bt` and check if the backtrace contains `recExecute`. If it does then continue execution using `c`.
Additionally, segfault printing can be disabled entirely in GDB using the command `handle SIGSEGV noprint`.
-----
## On to some outdated stuff!!
Note, it is 2023, not 2021. Both 2021 sets of instructions are outdated, as they are for wx builds. Leaving until they can be properly updated to qt 6, as most of the list of dependencies should be useful.
For Ubuntu 22.04+, I'd suggest:
apt install qt6-base-dev qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools
For 20.04, probably this:
sudo add-apt-repository ppa:okirby/qt6-backports
sudo apt-get update
apt install qt6-base-dev qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools
And Fedora'd be something like:
yum install qt6-qtbase-devel qt6-qtbase-private-devel qt6-qttools-devel
All of those worked at some point, but haven't been tested recently.
## How to compile PCSX2 in 2021 (Ubuntu 20.04) (64bit)
<!--- I've wasted more time than I'd like to admit searching for this -->
Note: For Ubuntu 21.10 (and probably the next LTS 22.04) libllvm10 is no longer in the packages list. Installing llvm 14 from https://apt.llvm.org/ seems to work. <!-- at least for me I could build it when I installed LLVM from here -->
```
sudo apt remove gcc-9 g++-9
sudo apt install cmake g++-10-multilib libaio-dev libasound2-dev libcairo2-dev libegl-dev \
libegl1-mesa-dev libgdk-pixbuf2.0-dev libgirepository-1.0-1 libgl-dev libgl1-mesa-dev \
libgl1-mesa-dri libgles-dev libgles-dev libgles2-mesa-dev libglib2.0-dev libglu1-mesa-dev \
libglu1-mesa libglvnd-dev libglx-dev libglx-mesa0 libglx0 libgtk-3-dev libgtk2.0-dev \
libharfbuzz-dev liblzma-dev libpango1.0-dev libpcap0.8-dev libpulse-dev \
libsdl2-dev libsamplerate0-dev libsoundtouch-dev libwxgtk3.0-gtk3-0v5 libwxgtk3.0-gtk3-dev \
libx11-xcb-dev libxext-dev libxft-dev libxml2-dev portaudio19-dev zlib1g-dev libllvm10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
git clone https://github.com/PCSX2/pcsx2.git
mkdir pcsx2/build && cd pcsx2/build
git submodule update --init --recursive
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_REPLAY_LOADERS=TRUE -DCMAKE_BUILD_PO=FALSE -DDISABLE_SETCAP=TRUE ..
make -j$(nproc)
make install
cd ../bin
./pcsx2
```
## How to compile PCSX2 in 2021 (Fedora)
See [the latest instructions on the PCSX2 wiki](https://wiki.pcsx2.net/PCSX2_Documentation/Compiling_on_Linux).
## How to compile PCSX2 in 2021 (Gentoo & Derivatives):
```
sudo emerge -av net-libs/libpcap x11-libs/wxGTK media-libs/libsoundtouch dev-libs/libaio \
media-libs/libsdl2 app-arch/lzma net-libs/libpcap dev-libs/libxml2
git clone https://github.com/PCSX2/pcsx2.git
mkdir pcsx2/build && cd pcsx2/build
git submodule update --init --recursive
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_REPLAY_LOADERS=TRUE -DCMAKE_BUILD_PO=FALSE -DGTK3_API=TRUE \
-DwxWidgets_CONFIG_EXECUTABLE="/usr/lib64/wx/config/gtk3-unicode-3.0-gtk3" \
-DPACKAGE_MODE=TRUE -DCMAKE_INSTALL_PREFIX=/usr ..
make -j$(nproc)
make install
cd ../bin
```