ollvm 在 windows10 下安装
本文档源码主要来源大神heroims的整理: OLLVM代码混淆移植与使用
为了ollvm 能够自定义混淆,所以需要修改源码来重新编译
本文档生成日期 2021/4/16 ,所用软件皆为最新版本,以作参考
IOS 版本比较容易编译,请移步其他文档
本文档使用make来编译,没有采用VS来编译(没成功过:smile:),
简要步骤说明
配置环境 MinGW-w64 (成功关键,下面有详细步骤);
下载ollvm 源码
git clone -b llvm-9.0.1 https://github.com/heroims/obfuscator.git
;mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ../obfuscator
mingw32-make -j12
;//12 这里根据你的CPU核数来修改 ,因为mingw目录下没有make测试混淆结果 ;
.\build\bin\clang++ test.cpp -o test.o4 -mllvm -sub -mllvm -fla -mllvm -sobf
这个版本的 -mllvm -bcf 好像有问题,会卡住不动!!!
GCC编译器选择
各种GCC编译器MinGW、MinGW-W64、TDM-GCC,我误装了TDM-GCC对新版本支持不够,导致各种问题 ,更多区别:https://blog.csdn.net/lemon4869/article/details/107403560
1. TDM-GCC-64
最高的时候我默认安装了TDM-GCC-64 ,开始菜单按mingw居然跳到这个gcc目录????
setting up environment for using MinGW with GCC from C:\TDM-GCC-64\.
C:\TDM-GCC-64>gcc -version
gcc: error: unrecognized command line option '-version'
gcc: fatal error: no input files
compilation terminated.
C:\TDM-GCC-64>gcc --version
gcc (tdm64-1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\TDM-GCC-64>
也许对ollvm 4.0 编译是没有问题,但后面最新的版本完全无能为力,各种错误
`
2 MingGW-W64
这个编译成功的关键
C:\mingw64\mingw64\bin>.\gcc.exe --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
下载与安装也需要注意:(参考:https://zhuanlan.zhihu.com/p/76613134)
下载去官网 http://mingw-w64.org/ 下载页面,选择: MingW-W64-builds
安装界面选择这也是个关键点
version ,可以选择最高版本
architecture - > 64位机器就选择x86_64 ,32位选择i686
Threads : 选择 **posix!!!!!!!!!!! *(unix系统) ,我之前选择了win32导致编译不成功
1.编译不成功 : versionhelpers.h : not such file or directory
cmake加个参数:-DLLVM_INCLUDE_BENCHMARKS=OFF
或者修改cmakelists.txt中的LLVM_INCLUDE_BENCHMARKS ON 改成OFF
2. 编译90%退出
F:/ndk/z3/bin/libz3.lib: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
安装一个z3 ,和你平台对应,32位还是64位