Building for Linux | Citra | Nintendo 3DS Emulator
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
  • Qt

    • Deb: apt-get install qtbase5-dev libqt5opengl5-dev
    • Arch: pacman -S qt5
  • GCC v5+ (for C++14 support)

    • Deb: apt-get install build-essential
    • Arch: pacman -S base-devel
  • CMake 3.1+

    • Deb: apt-get install cmake
    • Arch: pacman -S cmake
  • Clang 3.8 (optional build alternative)

    • Deb: apt-get install clang libc++-dev (in some distros, clang-3.8).
    • Arch: pacman -S clang libc++

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:

Using gcc:

mkdir build && cd build
cmake ../
make
sudo make install

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++ vs. , otherwise your build will likely fail. libc++ is not 100% complete on GNU/Linux, but works well for this build. The libstdc++ std::string is a different data structure than the libc++ std::string. See: LLVLM.org. If libc++ is not used, some warnings are treated as errors. Using clang is only really recommended for users not using GCC >= 5. Also see Clang Comparison.

mkdir build && cd build
cmake  -DCMAKE_CXX_COMPILER=clang++-3.8 \
	-DCMAKE_C_COMPILER=clang-3.8 \
	-DCMAKE_CXX_FLAGS="-O2 -g -stdlib=libc++"  ..
make
sudo make install (currently doesn't work, needs to be fixed)

Debian/Ubuntu: Owing to bug #808086 the build might fail. To have it build, add the following after line 1938 of /usr/include/c++/v1/string. (see discussion on StackOverflow for more details.)

#if _LIBCPP_STD_VER ::value)
#else
    _NOEXCEPT
#endif

Additionally, on Ubuntu, do sudo apt-get install libc++abi-dev && sudo ln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h

Building Citra (Optimized):

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install (currently doesn't work, needs to be fixed)

Building with debug symbols:

cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make

Running without installing:

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

# SDL
cd build/src/citra/
./citra

# Qt
cd build/src/citra_qt/
./citra-qt

Debugging:

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

(gdb) bt