Skip to content

Building SPMod on Linux

Karol Szuster edited this page Aug 4, 2018 · 6 revisions

Overview

Building SPMod on Linux

Instructions for building SPMod on Linux using Clang and GCC.

Requirements

  • Meson 0.44+
  • Ninja
  • Git
  • Compiler fully supporting C++17

Prerequisites

  1. Clone SPMod repository
    git clone --recursive https://github.com/Amaroq7/SPMod.git
  2. Create folder inside SPMod repository called build
  3. (Clang only) Build libcxx & libcxxabi.

Building

Clang

  1. Copy following files to build folder:

    • /path/to/libcxxabi_build/lib/libc++abi.so.1.0 and rename it to libc++abi.so.1,
    • /path/to/libcxxabi_build/lib/libc++abi.a,
    • /path/to/libcxx_build/lib/libc++.so.1.0 and rename it to libc++.so.1,
    • /path/to/libcxx_build/lib/libc++.a,
    • /path/to/libcxx_build/lib/libc++experimental.a.
  2. Copy content of following folders into include/llvm folder:

    • /path/to/libcxx/include/*,
    • /path/to/libcxxabi/include/*.
  3. Enter build directory

  4. Generate initial build files
    meson .. .

  5. (Optional) If you wish to build SPMod by linking it dynamically which results in smaller size
    meson configure -D linktype=dynamic

  6. To change build type (plain, debug, debugoptimized, release, minsize)
    default: debug
    meson configure -D buildtype=type e.g. meson configure -D buildtype=release

  7. Check configuration
    meson configure

  8. Build
    ninja

GCC

  1. Enter build directory

  2. Generate initial build files
    meson .. .

  3. Set C++17 and C11 standard
    meson configure -Dcpp_std=c++17 -Dc_std=c11

  4. (Optional) If you wish to build SPMod by linking it dynamically which results in smaller size
    *Warning* libgcc_s.so.1 and libstdc++.so.6 are bundled with HLDS by default. If you enable this option they should be removed, it'll allow SPMod to be linked against system's ones. If you're not sure if your system has ones which support C++17 it'd better not change this option.
    meson configure -D linktype=dynamic

  5. To change build type (plain, debug, debugoptimized, release, minsize)
    default: debug
    meson configure -D buildtype=type e.g. meson configure -D buildtype=release

  6. Check configuration
    meson configure

  7. Build
    ninja

Conclusion

If all the steps above have been completed, compiled binary should be present in /path/to/spmod/build/src.