Linux Compilation Tutorial
About 635 wordsAbout 2 min
Warning
This tutorial requires readers to have some Linux environment configuration ability and programming foundation! If you just want to run MAA instead of compiling it yourself, please read User Manual - Linux Emulators and Containers.
Note
MAA's build method is still under discussion. The content of this tutorial may be outdated. Please refer to the scripts in GitHub workflow file.
You can also refer to AUR PKGBUILD or nixpkgs.
Info
Mac can use the tools/build_macos_universal.zsh script for compilation. It's recommended to refer to the README.md of the MaaAssistantArknights/MaaMacGui project.
Compiling MaaCore
Download compilation dependencies
Ubuntu/Debiansudo apt-get install cmake ninja-buildArchsudo pacman -S --needed cmake ninjaBuild third-party libraries
Choose one of the following methods:
Download pre-built third-party libraries (recommended)
python tools/maadeps-download.pyInfo
Pre-built third-party libraries are cross-compiled using the MaaLinuxToolchain toolchain and require glibc version as low as 2.31 (Ubuntu 20.04). If you still encounter ABI incompatibility issues, you can use a container or try building the third-party libraries from scratch.
Build third-party libraries from scratch (will take considerable time)
git clone --recurse-submodules https://github.com/MaaAssistantArknights/MaaDeps.git cd MaaDeps # If the system is too old to use our prebuilt llvm 20, please consider using local build enviroment instead of cross compiling. # The toolchain config under src/MaaUtils/MaaDeps/cmake needs to be modified. python linux-toolchain-download.py python build.py
Compile MAA
cmake --preset linux-x64 -DINSTALL_RESOURCE=ON -DINSTALL_PYTHON=ON cmake --build build cmake --install build --prefix <target_directory>The first two commands generate
build/bin/Debug/libMaaCore.so(andlibMaaUtils.so), and the third command installs (i.e., copies) the build artifacts to the target directory.About the CMake Options
-DINSTALL_RESOURCE=ONcopies theresourcedirectory to the installation directory. MaaCore requires theresourcedirectory to run.-DINSTALL_PYTHON=ONcopies the Python integration (src/Python) to the installation directory. If you do not use it or plan to use it directly from the repository source code, you can omit this option.Tips
It is recommended to run MAA by specifying the dynamic library path or
LD_LIBRARY_PATH. Do not use root privileges to install MAA into/usr.Compile MaaFramework components
To debug MaaFwAdbController (MaaFwAdb touch mode) features, you need to compile the Debug version of MaaFramework yourself and place
libMaaAdbControlUnit.soin the installation directory.Run
Refer to programming language APIs and Using Python on how to use the MAA dynamic library.
Compiling MaaWpfGui
Note
MaaWpfGui is built for Windows. Wine is required to run MaaWpfGui on Linux. See Using Wine for details.
Prepare
MaaCore.dllMaaWpfGui depends on
MaaCore.dll(and other DLLs it depends on). Currently, there is no way to cross-compileMaaCore.dllfor Windows on Linux. While it is possible to copy these DLLs from MAA for Windows, mismatching version numbers will cause problems.Therefore, the recommended approach is to compile MaaCore first according to the previous section (without installing), then compile MaaWineBridge, and place the resulting
MaaCore.dllinto thebuild/bin/Debugdirectory.Install .NET SDK
Ubuntusudo apt install dotnet-sdk-10.0Archsudo pacman -S --needed dotnet-sdkSee also Install .NET on Linux.
Compile MaaWpfGui
Run in the repository root:
dotnet build src/MaaWpfGui/MaaWpfGui.csproj -p:Platform=x64Dependencies will be downloaded automatically during the first build. This generates
build/bin/Debug/MAA.exe.Run
wine build/bin/Debug/MAA.exe
