Win7 MSYS2(20220128) 编译OLLVM5

使用jni时想到加密问题,看到有ollvm,尝试在win7上编译成功,转载请注明,谢谢!

1 安装msys2

从官网下载安装文件msys2-x86_64-20220128.exe,按照提示安装。

安装完成后打开msys2 shell,更新一下:

1)同步一下本地包数据库以及基础包 pacman: -Syu

2)如果只更新本地包数据库用 : pacman -Sy

2.安装编译工具

在msys2 shell执行:

pacman -S --needed git wget mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-make make mingw-w64-x86_64-python3 autoconf libtool

后面编译发现还需要安装

pacman -S mingw-w64-x86_64-dlfcn

3.下载OLLVM源码

从 https://github.com/heroims/obfuscator.git 取出ollvm5源码,git取或者直接去网站取分支包,这里省略。

4.编译

打开mingw64的shell。

cd ollvm5
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..

//等配置完
mingw32-make

编译时会出现错误 :

include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h:722:26: error: could not convert '((llvm::orc::remote::OrcRemoteTargetClient<ChannelT>*)this)->callB<llvm::orc::remote::OrcRemoteTargetRPCAPI::ReadMem>(Src, Size)' from 'Expected<vector<unsigned char,allocator<unsigned char>>>' to 'Expected<vector<char,allocator<char>>>'
  722 |     return callB<ReadMem>(Src, Size);
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~
      |                          |
      |                          Expected<vector<unsigned char,allocator<unsigned char>>>

需要修改 \include\llvm\ExecutionEngine\Orc\OrcRemoteTargetClient.h 的716行,

" Expected<std::vector<char>> readMem(char *Dst, JITTargetAddress Src,"  改成

 "Expected<std::vector<uint8_t>> readMem(char *Dst, JITTargetAddress Src,"

编译顺利完成。

5.整合到NDK

需要用到编译出来的bin跟lib目录,参考其他文章整合。

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值