Window10编译Ollvm环境

时间:2024-03-28 21:48:02

在linux环境下编译:https://blog.csdn.net/u014476720/article/details/85097441

 

在window10环境下编译,需要羡慕两个软件工具:

刚开始用了mingw-w64最新包8.1.0一直编译不成功,后来用了5.4.0的,就可以正常编译

1.mingw-w64离线包下载:

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.4.0/threads-posix/seh/x86_64-5.4.0-release-posix-seh-rt_v5-rev0.7z

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 -DCMAKE_BUILD_TYPE:String=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. make -j2   //这个2是代表线程数,主要还是看你的电脑,我这里是用虚拟机的,我设置了4个处理器,然后很卡,所有就用了两个线程,反正这里编译用了很长时间,如果一直卡死被杀进程,你就减少线程数据就行了,1个也行的

成功之后,用到的就只有build(刚刚创建的那个文件夹的)目录下bin和lib目录下的文件
 

编译成功的:

 

Window10编译Ollvm环境

 

编译成功后看这篇:https://blog.csdn.net/u014476720/article/details/87257489

 

参考:

https://blog.csdn.net/hzhdy/article/details/94737931