eshard / obfuscator-llvm

Other
223 stars 42 forks source link

How to use with MSVC #12

Open MMitsuha opened 1 year ago

MMitsuha commented 1 year ago

My develop environment is Windows and Visual Studio, how can I use the project with them, I didn't see any documentation. Sincerely thanks to reply.

PatriceBlin commented 1 year ago

Hi,

This project build on top of LLVM as a library. You first need to compile LLVM for Windows and then compile this one with CMake.

https://llvm.org/docs/GettingStartedVS.html

Once you have LLVM installed somewhere, you only need to provide the path of the cmake folder and compile.
https://learn.microsoft.com/en-us/cpp/build/customize-cmake-settings
If you are used to terminals (like powershell) I guess you could follow the README.md

待たせてごめん またせてごめん

MMitsuha commented 1 year ago

It gives me a lot of errors... I followed the README, and I failed to complie obfuscator-llvm

build.log

PatriceBlin commented 1 year ago

Most of the logs are warnings, on LLVM headers and some on our plugins.

But your error is

C:\Users\cz251\source\repos\obfuscator-llvm\utils/CryptoUtils.h(85): fatal error C1189: #error: "Unknown endianness of the compilation platform, check this header aes_encrypt.h"

It's from

./utils/CryptoUtils.h

#if !defined(ENDIAN_BIG) && !defined(ENDIAN_LITTLE)
#error                                                                         \
    "Unknown endianness of the compilation platform, check this header aes_encrypt.h"
#endif

If you are building from a Windows x86_64 could you try this modification ?

diff --git a/utils/CryptoUtils.h b/utils/CryptoUtils.h
index 8964c41..6cc9617 100644
--- a/utils/CryptoUtils.h
+++ b/utils/CryptoUtils.h
@@ -47,7 +47,7 @@ extern ManagedStatic<CryptoUtils> cryptoutils;
 #endif
 #define ENDIAN_64BITWORD

-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(_M_X64)

 #ifndef ENDIAN_LITTLE
 #define ENDIAN_LITTLE

I don't have a Windows with MSVC on hand to check if it works but I saw this macro used inside LLVM so it might just works.