确定你正在使用的ndk版本
查看build.gradle
ndkVersion '21.4.7075529'
确定你使用的ndk的ollvm版本
C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-config.exe --version
9.0.9svn
确定了ollvm版本后
这是需要用到的轮子
https://github.com/heroims/obfuscator
那我这里克隆llvm-9.0.0分支
git clone https://github.com/heroims/obfuscator.git -b llvm-9.0
安装cmake
choco install make
下载这个版本的mingw
winlibs-x86_64-posix-seh-gcc-11.3.0-llvm-14.0.3-mingw-w64msvcrt-10.0.0-r3.zip
重要!!
set PATH=E:\mingw64\bin;%PATH%
否则,会报如下错误
E:/git_clone/obfuscator-9.0.0/lib/Support/ErrorHandling.cpp:131:24: error: 'mutex' is not a member of 'std'
E:/git_clone/obfuscator-9.0.0/lib/Support/ErrorHandling.cpp:131:24: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
E:/git_clone/obfuscator-9.0.0/lib/Support/ErrorHandling.cpp:131:29: error:
中途两个库报错,
from E:/git_clone/obfuscator-9.0.0/lib/Demangle/MicrosoftDemangle.cpp:16:
E:/git_clone/obfuscator-9.0.0/include/llvm/Demangle/MicrosoftDemangleNodes.h:33:17: error: found ':' in nested-name-specifier, expected '::'
33 | enum Qualifiers : uint8_t {
如图需要手动引入两个库
#include <stddef.h>
#include <limits.h>
现在开始编译
生成makefile文件
C:/Users/Administrator/AppData/Local/Android/Sdk/cmake/3.22.1/bin/cmake.exe .. -G "Unix Makefiles"
执行编译
C:/Users/Administrator/AppData/Local/Android/Sdk/ndk/21.4.7075529/prebuilt/windows-x86_64/bin/make.exe -j7 -I C:/Users/Administrator/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/9.0.9 /include
正在努力编译中,我这电脑跑了近3个小时了~
中途有报错,看起来是内存不足 加上编译参数-mcmodel=medium(中级) -mcmodel=large(高级)
4个bin文件
clang、clang-9、clang-format、clang++
4个头文件
stdarg.h 、stddef.h 、__stddef_max_align_t.h 、float.h
最后…失败了…吭太多
到mac一次编译成功😓