From e37f5cca39603cc916db7acfc93fa9cf4ce85331 Mon Sep 17 00:00:00 2001 From: nekosu Date: Wed, 10 Sep 2025 11:55:22 +0800 Subject: [PATCH] doc: update linux tutorial (en) --- docs/en-us/develop/linux-tutorial.md | 29 ++++++++++++++++++++-------- docs/zh-cn/develop/linux-tutorial.md | 13 +++++++++++-- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/docs/en-us/develop/linux-tutorial.md b/docs/en-us/develop/linux-tutorial.md index 11637c592a..c138e61521 100644 --- a/docs/en-us/develop/linux-tutorial.md +++ b/docs/en-us/develop/linux-tutorial.md @@ -22,14 +22,19 @@ Mac can use the `tools/build_macos_universal.zsh` script for compilation. It's r - Ubuntu/Debian ```bash - sudo apt install gcc-14 g++-14 cmake zlib1g-dev + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 20 + sudo apt install cmake ``` - Arch Linux - ```bash - sudo pacman -S --needed gcc cmake zlib - ``` + ```bash + sudo pacman -S --needed cmake + # also, llvm 20 is needed. + # clang-20, clang++-20 are required to be found in PATH + ``` 2. Build third-party libraries @@ -38,10 +43,12 @@ Mac can use the `tools/build_macos_universal.zsh` script for compilation. It's r - Download pre-built third-party libraries (recommended) > **Note** - > Contains dynamic libraries compiled on relatively new Linux distributions (Ubuntu 22.04). If your system's libstdc++ version is older, you may encounter ABI incompatibility issues. + > ~~Contains dynamic libraries compiled on relatively new Linux distributions (Ubuntu 22.04). If your system's libstdc++ version is older, you may encounter ABI incompatibility issues.~~ + > After introducing cross compiling to lower the runtime requirement, only glibc 2.31 (aka. ubuntu 20.04) is required now. ```bash python tools/maadeps-download.py + python tools/linux-toolchain-download.py ``` If you find the libraries downloaded above cannot run on your system due to ABI version issues and you don't want to use container solutions, you can also try compiling from scratch @@ -49,22 +56,28 @@ Mac can use the `tools/build_macos_universal.zsh` script for compilation. It's r - Build third-party libraries from scratch (will take considerable time) ```bash - git submodule update --init --recursive + git clone https://github.com/MaaAssistantArknights/MaaDeps cd MaaDeps + # If the system is too old to install llvm 20, please consider using local build enviroment instead of cross compiling. + # The toolchain config under MaaDeps/vcpkg-overlay/triplet needs to be modified. + python linux-toolchain-download.py python build.py ``` 3. Compile MAA ```bash - CC=gcc-14 CXX=g++-14 cmake -B build \ + cmake -B build \ -DINSTALL_RESOURCE=ON \ - -DINSTALL_PYTHON=ON + -DINSTALL_PYTHON=ON \ + -DCMAKE_TOOLCHAIN_FILE=cmake/linux/maa-x64-linux-toolchain.cmake cmake --build build ``` To install MAA to target location, note that MAA is recommended to run by specifying `LD_LIBRARY_PATH`, don't use administrator privileges to install MAA into `/usr` + > Now it shall be able to run without specifying `LD_LIBRARY_PATH` + ```bash cmake --install build --prefix ``` diff --git a/docs/zh-cn/develop/linux-tutorial.md b/docs/zh-cn/develop/linux-tutorial.md index ec38b640d7..389210670e 100644 --- a/docs/zh-cn/develop/linux-tutorial.md +++ b/docs/zh-cn/develop/linux-tutorial.md @@ -28,6 +28,15 @@ Mac 可以使用 `tools/build_macos_universal.zsh` 脚本进行编译。建议 sudo apt install cmake ``` + - Arch Linux + + ```bash + sudo pacman -S --needed cmake + # 另外, 需要安装 llvm 20 + # clang-20, clang++-20 + # 在 PATH 中需要能找到 clang-20, clang++-20 + ``` + 2. 构建第三方库 可以选择下载预构建的依赖库或从头进行编译 @@ -50,7 +59,7 @@ Mac 可以使用 `tools/build_macos_universal.zsh` 脚本进行编译。建议 ```bash git clone https://github.com/MaaAssistantArknights/MaaDeps cd MaaDeps - # 如果系统环境过低, 请考虑不使用交叉编译, 而是直接使用本地编译环境. + # 如果系统环境过低无法安装 llvm 20, 请考虑不使用交叉编译, 直接使用本地编译环境. # 需要调整 MaaDeps/vcpkg-overlay/triplet 中的 toolchain 配置. python linux-toolchain-download.py python build.py @@ -68,7 +77,7 @@ Mac 可以使用 `tools/build_macos_universal.zsh` 脚本进行编译。建议 来将 MAA 安装到目标位置, 注意 MAA 推荐通过指定 `LD_LIBRARY_PATH` 来运行, 不要使用管理员权限将 MAA 装入 `/usr` - > 现在应该不需要指定LD_LIBRARY_PATH即可运行, 有问题提issue吧 + > 现在应该不需要指定 `LD_LIBRARY_PATH` 即可运行 ```bash cmake --install build --prefix