open-obfuscator / o-mvll

:electron: O-MVLL is a LLVM-based obfuscator for native code (Android & iOS)
https://obfuscator.re/omvll
Apache License 2.0
574 stars 62 forks source link

Why not read cmake dependencies from environment #5

Closed xxr0ss closed 1 year ago

xxr0ss commented 1 year ago

I'm building o-mvll with VSCode, currently in src/CMakeLists.txt, there're NO_DEFAULT_PATH which prevent cmake to read dependencies' path from environment variables.

find_package(LLVM 14 REQUIRED CONFIG NO_DEFAULT_PATH)
find_package(Clang REQUIRED CONFIG. NO_DEFAULT_PATH)

find_package(spdlog REQUIRED CONFIG)
find_package(pybind11 REQUIRED CONFIG NO_DEFAULT_PATH)

However I think it's not very convinent when I'm using VSCode with settings.json:

{
    "cmake.sourceDirectory": "${workspaceFolder}/src",
    "cmake.generator": "Ninja",
    "cmake.environment": {
        "LLVM_DIR": "/usr/lib/llvm-14/cmake",
        "Clang_DIR": "/usr/lib/cmake/clang-14",
        "pybind11_DIR": "/usr/lib/cmake/pybind11"
    }
}

but this doesn't work, and cmake will give an error:

  Could not find a package configuration file provided by "LLVM" with any of
  the following names:
    LLVMConfig.cmake
    llvm-config.cmake
  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set "LLVM_DIR"

to let cmake use DIRs from "cmake.environment", I have to remove NO_DEFAULT_PATH: and I prefer to set dependencies path in "cmake.environment" like below:

find_package(LLVM 14 REQUIRED CONFIG)
find_package(Clang REQUIRED CONFIG)

find_package(spdlog REQUIRED CONFIG)
find_package(pybind11 REQUIRED CONFIG)

For what I understand, it could be more convinent if we can use the environment approach for VSCode. because there's no "best practice to develop o-mvll", I'm not sure if NO_DEFAULT_PATH is actually a more reasonable choice in your local workflow. I would greatly appreciate hearing your opinion!

xxr0ss commented 1 year ago

oh well, after I failed to use llvm + clang + gcc-aarch64-linux-gnu built omvll.so to cross compile obfuscated programs, with which I can't get rid of Segment Faults, I realized:

o-mvll is designed to be only used with NDK LLVM or XCode LLVM.

😵Sorry to open this issue, never mind.