Read First!

The below wiki article is based on user submitted content.
Please verify all hyperlinks and terminal commands below!

See a mistake? Want to contribute? Edit this article on Github

Building for Linux

An unofficial PKGBUILD of Citra is available for Arch Linux on the AUR.

Dependencies:

You’ll need to download and install the following to build Citra:

  • SDL2

    • Deb: apt-get install sdl2 or apt-get install libsdl2-2.0-0 or apt-get install libsdl2-dev
    • Arch: pacman -S sdl2
    • Fedora: dnf install SDL2-devel
  • Qt 5.9+

    • Only 5.9+ versions are tested. Lower version might or might not work. See the section Install new Qt version below if your distro does not provide a sufficient version of Qt
    • Deb: apt-get install qtbase5-dev libqt5opengl5-dev qtmultimedia5-dev
    • Arch: pacman -S qt5
    • Fedora: dnf install qt5-qtmultimedia-devel
  • Compiler: GCC or Clang. You only need one of these two:

    • GCC 7.0+.
    • Deb: apt-get install build-essential
    • Arch: pacman -S base-devel
    • Fedora: dnf install gcc-c++
    • Clang 5.0+
    • Deb: apt-get install clang libc++-dev (in some distros, clang-5.0).
    • Arch: pacman -S clang, libc++ is in the AUR. Use pacaur or yaourt to install it.
  • CMake 3.8+

    • Deb: apt-get install cmake
    • Arch: pacman -S cmake
    • Fedora: dnf install cmake
  • Note on Boost library: you don’t need to install Boost library on your system, because citra provides a bundled trimmed Boost library. However, if you already have Boost library installed on your system, please make sure its version is at least 1.66 (which contains a bug fix for GCC 7), otherwise compilation would fail.

Cloning Citra in Git:

git clone --recursive https://github.com/citra-emu/citra
cd citra

The --recursive option automatically clones the required Git submodules too.

Building Citra in Debug Mode (Slow):

Using gcc:

mkdir build && cd build
cmake ../
make
sudo make install (optional)

Optionally, you can use "cmake -i .." to adjust various options (e.g. disable the Qt GUI).

Using clang:

Note: It is important you use libc++, otherwise your build will likely fail:

mkdir build && cd build
cmake  -DCMAKE_CXX_COMPILER=clang++-5.0 \
	-DCMAKE_C_COMPILER=clang-5.0 \
	-DCMAKE_CXX_FLAGS="-O2 -g -stdlib=libc++" ..
make
sudo make install (optional)

Building Citra in Release Mode (Optimized):

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install (optional)

Building with debug symbols:

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make
sudo make install (optional)

Running without installing:

After building, the binaries citra and citra-qt (depending on your build options) will end up in build/bin/.

# SDL
cd build/bin/
./citra

# Qt
cd build/bin/
./citra-qt

Debugging:

cd data
gdb ../build/src/citra_qt/citra-qt
(gdb) run

(gdb) bt

Install new Qt version

If you had an error while building citra-qt part (this part was added from an AutoMoc subprocess error when running a qt5/bin/moc command, but this may fix some other errors)

  • Go to http://download.qt.io/official_releases/qt/ and get the latest linux version link (this guide used 5.11.1 at the time) and run the following commands:

    wget link_to_latest_linux_official_release chmod +x qt-opensource-linux-x64-x.x.x.run ./qt-opensource-linux-x64-x.x.x.run

  • Install selecting only Desktop gcc option besides the Tools one that you can’t remove

  • Add those exports to your .bashrc file (change QTDIR variable if installing another version)

    export QTDIR="$HOME/Qt5.11.15.11.1/gcc_64" export PATH="$QTDIR/bin:$PATH" export LD_LIBRARY_PATH="$QTDIR/lib:$LD_LIBRARY_PATH"

  • Reload your .bashrc file and try building again from the start.