Skip to main content

Linux Compiling Tutorial

March 31, 2025About 1 min

Linux Compiling Tutorial

The tutorial requires some basic knowledge about Linux OS!
If you just want to install MAA directly instead of compiling it yourself, please read Emulator Support for Linux.

Note

Linux build of MAA is still under discussion, some of the content might be outdated, please follow the script in GitHub workflow file, also reference AUR PKGBUILD, nixpkgs

Compiling MAA

  1. Download build depends

    • Ubuntu/Debian

      sudo apt install gcc-12 g++-12 cmake zlib1g-dev
    • Arch Linux

      sudo pacman -S --needed gcc cmake zlib
  2. Build or download third-party libraries

    You may either download pre-built dependencies or build them from scratch

    • Download pre-built libraries (recommended)

      Note
      It contains shared objects built on a relatively new linux distro (Ubuntu 22.04), which may cause ABI incompatibility if you are working on a system with older version of libstdc++.

      python maadeps-download.py

    If this does not work for you due to ABI issue, and containerization is not an option, you may build them from scratch

    • Build from source

      git submodule update --init --recursive
      cd MaaDeps
      python build.py
  3. Build MAA

    CC=gcc-12 CXX=g++-12 cmake -B build \
        -DINSTALL_THIRD_LIBS=ON \
        -DINSTALL_RESOURCE=ON \
        -DINSTALL_PYTHON=ON
    cmake --build build

    To install MAA to the target location, note that MAA is recommended to run by specifying LD_LIBRARY_PATH, do not use administrator privileges to load MAA into /

    cmake --install build --prefix <target_directory>

Integration

Maybe not a doc

Python

Refer to the implementation of __main__ in Python demo

C

Refer to the implementation of CppSample

C Sharp

Refer to the implementation of MaaWpfGui

Translation Warning
MAA's documents are mainly in Simplified Chinese. Documents in other languages may be of low quality or not yet translated. Please understand.