编译Magisk为Android Pie API28模拟器Root时遇cxx-gen编译错误求助
编译Magisk时cxx-gen构建失败(Windows平台Git符号链接问题)
我尝试编译Magisk,用于给Android Studio里的Pie API 28模拟器获取Root权限,但执行python build.py all命令时出现编译错误,提示cxx-gen构建失败,要求Windows平台启用Git符号链接。我已经开启了系统的符号链接支持和开发者模式,但问题依然存在。
环境信息
OS Name Microsoft Windows 10 Pro Version 10.0.19045 Build 19045 python 3.8 jdk 8 android studio flamingo git
错误日志详情
PS C:\temp\repos\Magisk> python build.py all * Building binaries: magisk magiskinit magiskboot magiskpolicy busybox error: failed to run custom build command for `cxx-gen v0.7.94 (C:\temp\repos\Magisk\native\src\external\cxx-rs\gen\lib)` Caused by: process didn't exit successfully: `C:\temp\repos\Magisk\native\src\target\debug\build\cxx-gen-69026a18f023ca9c\build-script-build` (exit code: 1) --- stderr When building `cxx` from a git clone, git's symlink support needs to be enabled on platforms that have it off by default (Windows). Either use: $ git config --global core.symlinks true prior to cloning, or else use: $ git clone -c core.symlinks=true https://github.com/dtolnay/cxx for the clone. Symlinks are only required when compiling locally from a clone of the git repository---they are NOT required when building `cxx` as a Cargo-managed (possibly transitive) build dependency downloaded through crates.io.
解决步骤
配置Git全局符号链接支持
打开终端执行以下命令,确保Git全局配置中符号链接功能启用:git config --global core.symlinks true可通过
git config --global core.symlinks验证是否返回true。重新克隆Magisk仓库
原有仓库克隆时可能未应用符号链接配置,删除现有仓库后重新克隆:rm -rf C:\temp\repos\Magisk git clone -c core.symlinks=true https://github.com/topjohnwu/Magisk.git C:\temp\repos\Magisk确认系统符号链接权限
打开本地组策略编辑器(gpedit.msc),导航至计算机配置 > Windows设置 > 安全设置 > 本地策略 > 用户权限分配,找到创建符号链接,确认当前用户或所在用户组已被添加至列表中。以管理员身份编译
右键终端选择「以管理员身份运行」,再执行python build.py all命令,确保编译过程拥有足够权限创建符号链接。
内容的提问来源于stack exchange,提问作者denrzzz
相关产品推荐
相关产品推荐

