Help:Building RPCS3: Difference between revisions

Help page
(Added aquisition instructions for all & build steps for mac)
No edit summary
 
(26 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Official, up-to-date instructions for Windows and Linux can be found in the [https://github.com/RPCS3/rpcs3/blob/master/README.md readme]. However, many build platforms are supported partially by the development team. Meaning, pull requests are accepted from various members of the community who have taken to ensuring that other platforms build rpcs3 correctly. They are not always actively maintained by the dev team though, and as a result many unices such as macOS and freeBSD break often. Below, several less-common platforms have their build processes detailed.
Official, up-to-date instructions for Windows and Linux can be found in the [https://github.com/RPCS3/rpcs3/blob/master/README.md readme]. However, many build platforms are supported partially by the development team i.e. pull requests are accepted from various members of the community who have taken to ensuring that other platforms can also build RPCS3 correctly. However, they are not actively maintained by the development team, and as a result many Unices such as macOS and FreeBSD break often. You can find the build process detailed for several less-common platforms below.
 
==Dependencies==


== Dependencies ==
RPCS3 uses many 3rd party libraries and projects. Most notably, in order to build the project, you will need the following:
RPCS3 uses many 3rd party libraries and projects. Most notably, in order to build the project, you will need the following:


{|
* [https://cmake.org/download/ CMake 3.16.9+]
| [https://vulkan.lunarg.com/sdk/home Vulkan SDK]
* [https://www.python.org/downloads/ Python 3.6+]
|-
* [https://www.qt.io/download-qt-installer Qt 6.6.3]
| [https://cmake.org/download/ CMake 3.8.2+]
* [https://https://vulkan.lunarg.com/sdk/home Vulkan SDK 1.3.268.0] (Has to be this version) For instructions see "Install the SDK" [https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html here]
|-
| [https://www.python.org/downloads/ Python 3.3+]
|-
| [https://www.qt.io/download-qt-installer Qt 5.10+]
|}


In addition, a relatively modern compiler is needed. The project uses c++17, and as a result GCC 7.3 or Clang 5.0 are the minimum needed compilers.
In addition, GCC 11+ or Clang 12+ are the minimum needed compilers.
 
==Acquiring==


== Clone ==
Clone and initialize the repository:
Clone and initialize the repository:


<pre>
<pre>
git clone https://github.com/RPCS3/rpcs3.git
git clone https://github.com/RPCS3/rpcs3.git
cd rpcs3/
cd rpcs3
git submodule update --init
git submodule update --init
</pre>
</pre>


=macOS=
== macOS ==
 
Support for macOS is highly experimental.
Support for macOS is in its early stages. A few members of the community are working on getting Vulkan working on Macs, via Apple's awful MoltenVK. Support for OpenGL will likely never come to the platform. For development, it is recommended to use Xcode and install the following through the terminal
On Apple silicon Macs, Rosetta and the x64 version of Homebrew must be used:
<pre>
# run an x64 shell
arch -x86_64 zsh
# install x64 brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# set x64 brew env
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
# install dependencies
brew install llvm@18 molten-vk vulkan-headers sdl2 nasm ninja cmake glew git ffmpeg@5 python pipenv
brew link -f ffmpeg@5
</pre>


We need to install Qt6, brew's version is incompatible with the project so we get it manually
<pre>
<pre>
brew install glew llvm qt cmake
if [ ! -d "./6.6.3" ]; then
    mkdir -p "/tmp/Qt"
    mkdir -p "./6.6.3/macos"
    cd 6.6.3 && ln -s macos clang_64 && cd ..
    git -C /tmp/Qt clone https://github.com/engnr/qt-downloader.git
    git -C /tmp/Qt/qt-downloader checkout f52efee0f18668c6d6de2dec0234b8c4bc54c597
    export PIPENV_PIPFILE="/tmp/Qt/qt-downloader/Pipfile"
    pipenv install
    pipenv run /tmp/Qt/qt-downloader/qt-downloader macos desktop 6.6.3 clang_64 --opensource --addons qtmultimedia
fi
</pre>
</pre>


You will also need to remember to set environment vars:
You will also need to remember to set environment vars:


<pre>LLVM_DIR=/usr/local/opt/llvm/</pre> OR, wherever llvm was installed
<pre>
<pre>Qt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5</pre> OR, wherever qt was installed
export CXX=clang++
export CC=clang
export Qt6_DIR="$PWD/6.6.3/macos/lib/cmake/Qt6"
export PATH="$PWD/6.6.3/macos/bin:/usr/local/opt/llvm@18/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin"
export LDFLAGS="-L/usr/local/opt/llvm@18/lib -Wl,-rpath,/usr/local/opt/llvm@18/lib"
export CXXFLAGS="-I/usr/local/opt/llvm@18/include -msse -msse2 -mcx16 -no-pie"
export CPLUS_INCLUDE_PATH="/usr/local/opt/molten-vk/include"
export VULKAN_SDK="/usr/local/opt/molten-vk"
export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json"
</pre>


Build:
Some symbolic links to moltenVK may be necessary for CMake to detect Vulkan:


<pre>
<pre>
cd ../ && mkdir rpcs3_build && cd rpcs3_build
ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib"
cmake ../rpcs3/ && make GitVersion && make
mkdir -p 3rdparty/MoltenVK/MoltenVK/Build/Products/Release/dynamic && ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" ./3rdparty/MoltenVK/MoltenVK/Build/Products/Release/dynamic/libMoltenVK.dylib
</pre>
</pre>


Run RPCS3 with ./bin/rpcs3
=== Build ===
<pre>
cd .. && mkdir rpcs3_build && cd rpcs3_build
cmake -DUSE_DISCORD_RPC=OFF -DUSE_VULKAN=ON -DUSE_ALSA=OFF -DUSE_PULSE=OFF -DUSE_AUDIOUNIT=ON -G Ninja -DLLVM_CCACHE_BUILD=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_PERF=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF -DCMAKE_CXX_STANDARD=20 -DUSE_NATIVE_INSTRUCTIONS=OFF -DUSE_SYSTEM_FFMPEG=ON ../rpcs3/
ninja
</pre>


=Msys2=
=== Run ===
<pre>
open ./bin/rpcs3.app
</pre>


== Msys2 ==
There is some support for non-MSVC based compilation on Windows. The Msys2 platform using the Mingw build tools did work at one point, though it should be noted that the following instructions are outdated.
There is some support for non-MSVC based compilation on Windows. The Msys2 platform using the Mingw build tools did work at one point, though it should be noted that the following instructions are outdated.


=== Dependencies ===
<pre>
<pre>
## Deps
pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-yasm mingw-w64-x86_64-python2 mingw-w64-x86_64-ntldd-git mingw-w64-x86_64-qt5 mingw-w64-x86_64-openal mingw-w64-x86_64-glew git
pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-yasm mingw-w64-x86_64-python2 mingw-w64-x86_64-ntldd-git mingw-w64-x86_64-qt5 mingw-w64-x86_64-openal mingw-w64-x86_64-glew git
</pre>


## Clone
=== Clone ===
<pre>
git clone https://github.com/RPCS3/rpcs3.git
git clone https://github.com/RPCS3/rpcs3.git
cd rpcs3
cd rpcs3
git submodule update --init
git submodule update --init
</pre>


## Configure
=== Configure ===
<pre>
cd .. && mkdir rpcs3_build && cd rpcs3_build
cd .. && mkdir rpcs3_build && cd rpcs3_build
cmake -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make ../rpcs3/
cmake -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make ../rpcs3/
mingw32-make.exe GitVersion && mingw32-make.exe discord-rpc
mingw32-make.exe GitVersion && mingw32-make.exe discord-rpc
</pre>


## Build
=== Build ===
<pre>
mingw32-make -jX #X is core count
mingw32-make -jX #X is core count
</pre>


## Install
=== Install ===
<pre>
cd ./bin
cd ./bin
for l in $(ntldd.exe -R rpcs3.exe|grep mingw64|sed -e 's/^[ \t]*//'|cut -d' ' -f3);do cp $l .;done
for l in $(ntldd.exe -R rpcs3.exe|grep mingw64|sed -e 's/^[ \t]*//'|cut -d' ' -f3);do cp $l .;done
Line 80: Line 119:
cp /mingw64/share/qt5/plugins/platforms/qwindows.dll ./qt/plugins/platforms/
cp /mingw64/share/qt5/plugins/platforms/qwindows.dll ./qt/plugins/platforms/
cp /mingw64/share/qt5/plugins/styles/qwindowsvistastyle.dll ./qt/plugins/styles/
cp /mingw64/share/qt5/plugins/styles/qwindowsvistastyle.dll ./qt/plugins/styles/
</pre>


## Run
=== Run ===
<pre>
./rpcs3
./rpcs3
</pre>
</pre>


=CMake Build Options=
== CMake Build Options ==
 
All CMake options are enabled or disabled using the parameters <code>ON</code> or <code>OFF</code> respectively.
Build against the shared libpng instead of using the built-in one. libpng 1.6+ highly recommended. Try this option if you get version conflict errors or only see black game icons.
{| class="wikitable"
<pre>-DUSE_SYSTEM_LIBPNG=ON/OFF (default = *OFF*)</pre>
! Option !! Default !! Description
 
|-
Build against the shared ffmpeg libraries instead of using the built-in patched version. Try this if the built-in version breaks the OpenGL renderer for you.
| <code>-DUSE_NATIVE_INSTRUCTIONS=</code> || ON || Build with <code>-march=native</code>, which is useful for local builds, but not good for packages.
<pre>-DUSE_SYSTEM_FFMPEG=ON/OFF (default = *OFF*)</pre>
|-
 
| <code>-DWITH_LLVM=</code> || ON || Build with LLVM.
This forces RPCS3 to build with LLVM.
|-
<pre>-DWITH_LLVM=ON/OFF (default = *ON*)</pre>
| <code>-DBUILD_LLVM_SUBMODULE=</code> || ON || Build with pre-built LLVM libraries from [https://github.com/RPCS3/llvm/releases RPCS3 git submodule].
 
|-
This builds RPCS3 with support for debugging PS3 games using gdb.
| <code>-DUSE_ALSA=</code> || ON || Build with ALSA audio backend.
<pre>-DWITH_GDB=ON/OFF (default = *OFF*)</pre>
|-
 
| <code>-DUSE_PULSE=</code> || ON || Build with PulseAudio audio backend.
This builds RPCS3 with Vulkan support.
|-
<pre>-DUSE_VULKAN=ON/OFF (default = *ON*)</pre>
| <code>-DUSE_LIBEVDEV=</code> || ON || Build with libevdev-based joystick support.
 
|-
This builds RPCS3 with -march=native, which is useful for local builds, but not good for packages.
| <code>-DUSE_DISCORD_RPC=</code> || ON || Build with Discord Rich Presence integration.
<pre>-DUSE_NATIVE_INSTRUCTIONS=ON/OFF (default = *ON*)</pre>
|-
| <code>-DUSE_SYSTEM_ZLIB=</code> || ON || Build with system ZLIB instead of the built-in one.
|-
| <code>-DUSE_VULKAN=</code> || ON || Build with Vulkan support.
|-
| <code>-DBUILD_SHARED_LIBS=</code> || OFF || ?
|-
| <code>-DSKIP_GLSLANG_INSTALL=</code> || ? || ?
|-
| <code>-DENABLE_AMD_EXTENSIONS=</code> || ON || Build with support for AMD-specific extensions.
|-
| <code>-DENABLE_GLSLANG_BINARIES=</code> || ON || ?
|-
| <code>-DENABLE_NV_EXTENSIONS=</code> || ON || Build with support for NVIDIA-specific extensions.
|-
| <code>-DENABLE_HLSL=</code> || ON || ?
|-
| <code>-DENABLE_OPT=</code> || ON || ?
|-
| <code>-DUNITY_BUILD_EMU=</code> || OFF || ?
|-
| <code>-DUSE_SYSTEM_LIBPNG=</code> || OFF || Build against the shared libpng instead of using the built-in one. <br />libpng 1.6+ highly recommended. Try this option if you get version conflict errors or only see black game icons.
|-
| <code>-DUSE_SYSTEM_FFMPEG=</code> || OFF || Build against the shared FFmpeg libraries instead of using the built-in patched version. <br />Try this if the built-in version breaks the OpenGL renderer for you.
|}

Latest revision as of 16:32, 28 June 2024

Official, up-to-date instructions for Windows and Linux can be found in the readme. However, many build platforms are supported partially by the development team i.e. pull requests are accepted from various members of the community who have taken to ensuring that other platforms can also build RPCS3 correctly. However, they are not actively maintained by the development team, and as a result many Unices such as macOS and FreeBSD break often. You can find the build process detailed for several less-common platforms below.

Dependencies

RPCS3 uses many 3rd party libraries and projects. Most notably, in order to build the project, you will need the following:

In addition, GCC 11+ or Clang 12+ are the minimum needed compilers.

Clone

Clone and initialize the repository:

git clone https://github.com/RPCS3/rpcs3.git
cd rpcs3
git submodule update --init

macOS

Support for macOS is highly experimental. On Apple silicon Macs, Rosetta and the x64 version of Homebrew must be used:

# run an x64 shell
arch -x86_64 zsh
# install x64 brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# set x64 brew env
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
# install dependencies
brew install llvm@18 molten-vk vulkan-headers sdl2 nasm ninja cmake glew git ffmpeg@5 python pipenv
brew link -f ffmpeg@5

We need to install Qt6, brew's version is incompatible with the project so we get it manually

if [ ! -d "./6.6.3" ]; then
    mkdir -p "/tmp/Qt"
    mkdir -p "./6.6.3/macos"
    cd 6.6.3 && ln -s macos clang_64 && cd ..
    git -C /tmp/Qt clone https://github.com/engnr/qt-downloader.git
    git -C /tmp/Qt/qt-downloader checkout f52efee0f18668c6d6de2dec0234b8c4bc54c597
    export PIPENV_PIPFILE="/tmp/Qt/qt-downloader/Pipfile"
    pipenv install
    pipenv run /tmp/Qt/qt-downloader/qt-downloader macos desktop 6.6.3 clang_64 --opensource --addons qtmultimedia
fi

You will also need to remember to set environment vars:

export CXX=clang++
export CC=clang
export Qt6_DIR="$PWD/6.6.3/macos/lib/cmake/Qt6"
export PATH="$PWD/6.6.3/macos/bin:/usr/local/opt/llvm@18/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin"
export LDFLAGS="-L/usr/local/opt/llvm@18/lib -Wl,-rpath,/usr/local/opt/llvm@18/lib"
export CXXFLAGS="-I/usr/local/opt/llvm@18/include -msse -msse2 -mcx16 -no-pie"
export CPLUS_INCLUDE_PATH="/usr/local/opt/molten-vk/include"
export VULKAN_SDK="/usr/local/opt/molten-vk"
export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json"

Some symbolic links to moltenVK may be necessary for CMake to detect Vulkan:

ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib"
mkdir -p 3rdparty/MoltenVK/MoltenVK/Build/Products/Release/dynamic && ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" ./3rdparty/MoltenVK/MoltenVK/Build/Products/Release/dynamic/libMoltenVK.dylib

Build

cd .. && mkdir rpcs3_build && cd rpcs3_build
cmake -DUSE_DISCORD_RPC=OFF -DUSE_VULKAN=ON -DUSE_ALSA=OFF -DUSE_PULSE=OFF -DUSE_AUDIOUNIT=ON -G Ninja -DLLVM_CCACHE_BUILD=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_PERF=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF -DCMAKE_CXX_STANDARD=20 -DUSE_NATIVE_INSTRUCTIONS=OFF -DUSE_SYSTEM_FFMPEG=ON ../rpcs3/
ninja

Run

open ./bin/rpcs3.app

Msys2

There is some support for non-MSVC based compilation on Windows. The Msys2 platform using the Mingw build tools did work at one point, though it should be noted that the following instructions are outdated.

Dependencies

pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-yasm mingw-w64-x86_64-python2 mingw-w64-x86_64-ntldd-git mingw-w64-x86_64-qt5 mingw-w64-x86_64-openal mingw-w64-x86_64-glew git

Clone

git clone https://github.com/RPCS3/rpcs3.git
cd rpcs3
git submodule update --init

Configure

cd .. && mkdir rpcs3_build && cd rpcs3_build
cmake -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make ../rpcs3/
mingw32-make.exe GitVersion && mingw32-make.exe discord-rpc

Build

mingw32-make -jX #X is core count

Install

cd ./bin
for l in $(ntldd.exe -R rpcs3.exe|grep mingw64|sed -e 's/^[ \t]*//'|cut -d' ' -f3);do cp $l .;done

mkdir -p ./qt/plugins/{bearer,imageformats,platforms,styles}
cp /mingw64/share/qt5/plugins/bearer/qgenericbearer.dll ./qt/plugins/bearer/
cp /mingw64/share/qt5/plugins/imageformats/{qgif.dll,qicns.dll,qico.dll,qjpeg.dll,qtga.dll,qtiff.dll,qwbmp.dll,qwebp.dll} ./qt/plugins/imageformats/
cp /mingw64/share/qt5/plugins/platforms/qwindows.dll ./qt/plugins/platforms/
cp /mingw64/share/qt5/plugins/styles/qwindowsvistastyle.dll ./qt/plugins/styles/

Run

./rpcs3

CMake Build Options

All CMake options are enabled or disabled using the parameters ON or OFF respectively.

Option Default Description
-DUSE_NATIVE_INSTRUCTIONS= ON Build with -march=native, which is useful for local builds, but not good for packages.
-DWITH_LLVM= ON Build with LLVM.
-DBUILD_LLVM_SUBMODULE= ON Build with pre-built LLVM libraries from RPCS3 git submodule.
-DUSE_ALSA= ON Build with ALSA audio backend.
-DUSE_PULSE= ON Build with PulseAudio audio backend.
-DUSE_LIBEVDEV= ON Build with libevdev-based joystick support.
-DUSE_DISCORD_RPC= ON Build with Discord Rich Presence integration.
-DUSE_SYSTEM_ZLIB= ON Build with system ZLIB instead of the built-in one.
-DUSE_VULKAN= ON Build with Vulkan support.
-DBUILD_SHARED_LIBS= OFF ?
-DSKIP_GLSLANG_INSTALL= ? ?
-DENABLE_AMD_EXTENSIONS= ON Build with support for AMD-specific extensions.
-DENABLE_GLSLANG_BINARIES= ON ?
-DENABLE_NV_EXTENSIONS= ON Build with support for NVIDIA-specific extensions.
-DENABLE_HLSL= ON ?
-DENABLE_OPT= ON ?
-DUNITY_BUILD_EMU= OFF ?
-DUSE_SYSTEM_LIBPNG= OFF Build against the shared libpng instead of using the built-in one.
libpng 1.6+ highly recommended. Try this option if you get version conflict errors or only see black game icons.
-DUSE_SYSTEM_FFMPEG= OFF Build against the shared FFmpeg libraries instead of using the built-in patched version.
Try this if the built-in version breaks the OpenGL renderer for you.