在linux环境下编译:https://blog.csdn.net/u014476720/article/details/85097441
在window10环境下编译,需要羡慕两个软件工具:
刚开始用了mingw-w64最新包8.1.0一直编译不成功,后来用了5.4.0的,就可以正常编译
1.mingw-w64离线包下载:
2.cmake-3.16.2-win64-x64.msi 下载:
https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2-win64-x64.msi
1. git clone -b obfuscator https://github.com/obfuscator-llvm/obfuscator.git
2. mkdir build //这个目录主要是用于存放编译文件而已,其实不要紧的,到时都只是拿里面的编译后的文件来用而已
3. cd build
4.下面这个执行编译,有时会提示编译失败,说有个test 文件夹已存在
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ../obfuscator/
具体报错
CMake Error at cmake/modules/AddLLVM.cmake:1163 (add_custom_target):
add_custom_target cannot create target "check-llvm-bindings-ocaml" because
another target with the same name already exists. The existing target is a
custom target created in source directory "/opt/obfuscator-llvm-4.0/test".
See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
cmake/modules/AddLLVM.cmake:1226 (add_lit_target)
test/CMakeLists.txt:150 (add_lit_testsuites)
如果报错了,就加多一个编译配置参数
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ../obfuscator/
5. mingw32-make -j2 //这个2是代表线程数,主要还是看你的电脑,我这里是用虚拟机的,我设置了4个处理器,然后很卡,所有就用了两个线程,反正这里编译用了很长时间,如果一直卡死被杀进程,你就减少线程数据就行了,1个也行的
成功之后,用到的就只有build(刚刚创建的那个文件夹的)目录下bin和lib目录下的文件
编译成功的:
编译成功后看这篇:https://blog.csdn.net/u014476720/article/details/87257489
如果编译的时候报这个错误:error: use of undeclared identifier 'LONG_BIT'
设置一下你的minSdkVersion最新为21就行了
minSdkVersion 21
参考:
https://blog.csdn.net/hzhdy/article/details/94737931
https://www.cnblogs.com/suanguade/p/10913303.html
https://www.jianshu.com/p/e0637f3169a3