update and clean up

Weiyi Wang 2018-10-18 22:51:04 -04:00
parent 9aa83d5add
commit 76b4101d81

@ -8,21 +8,23 @@ You'll need to download and install the following to build Citra:
- 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](http://qt-project.org/downloads)
* [Qt](http://qt-project.org/downloads) 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`
* GCC v7+ (for C++17 support). _This guide was written for GCC v5+ before we bumping the version, so please refill them below after testing._
- ~~Deb: `apt-get install build-essential`~~
- ~~Arch: `pacman -S base-devel`~~
- ~~Fedora: `dnf install gcc-c++`~~
* 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](https://github.com/llvm-mirror/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](http://www.cmake.org/) 3.8+
- Deb: `apt-get install cmake`
- Arch: `pacman -S cmake`
- Fedora: `dnf install cmake`
* [Clang](https://github.com/llvm-mirror/clang) 5.0 (optional build alternative) _This guide was written before we bumping the version to C++17, so please refill them below after testing._
- ~~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.~~
* 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:
@ -42,38 +44,22 @@ The `--recursive` option automatically clones the required Git submodules too.
mkdir build && cd build
cmake ../
make
sudo make install
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++ 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](https://llvm.org/svn/llvm-project/www-releases/trunk/3.8.0/projects/libcxx/docs/UsingLibcxx.html). 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](http://clang.llvm.org/comparison.html).
Note: It is important you use libc++, otherwise your build will likely fail:
```
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=clang++-3.8 \
-DCMAKE_C_COMPILER=clang-3.8 \
cmake -DCMAKE_CXX_COMPILER=clang++-5.0 \
-DCMAKE_C_COMPILER=clang-5.0 \
-DCMAKE_CXX_FLAGS="-O2 -g -stdlib=libc++" ..
make
sudo make install (currently doesn't work, needs to be fixed)
sudo make install (optional)
```
Debian/Ubuntu: Owing to bug [#808086](https://bugs.debian.org/cgi-bin/bugreport.cgi?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](http://stackoverflow.com/questions/37096062/get-a-basic-c-program-to-compile-using-clang-on-ubuntu-16)
for more details.)
```
#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::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 in Release Mode (Optimized):
@ -81,27 +67,29 @@ do `sudo apt-get install libc++abi-dev && sudo ln -s /usr/include/libcxxabi/__cx
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install (currently doesn't work, needs to be fixed)
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/src/<binary_name>/`.
After building, the binaries `citra` and `citra-qt` (depending on your build options) will end up in `build/bin/`.
```
# SDL
cd build/src/citra/
cd build/bin/
./citra
# Qt
cd build/src/citra_qt/
cd build/bin/
./citra-qt
```
@ -113,4 +101,23 @@ gdb ../build/src/citra_qt/citra-qt
(gdb) run
<crash>
(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.1/5.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.