secure-software-engineering / phasar

A LLVM-based static analysis framework.
Other
930 stars 140 forks source link

Conan migration #516

Open jusito opened 2 years ago

jusito commented 2 years ago

Phasar meets conan

Our main idea was to reuse our just-simple.cmake, which is like phasar_macros.cmake but more generic, and apply it with all its features to phasar. It took us around a year to mature it, always in mind with good cmake practice. This simplifies the cmake maintenance a lot.

(only for internal) Prepare conan to use prebuild llvm packages

  1. If you have access to our internal gitlab you can reuse my compiled llvm, else you need to compile it 4 times if you want to test every config.
  2. pip3 install conan
  3. conan config init
  4. conan profile update settings.compiler=clang default
  5. conan profile update settings.compiler.version=14 default
  6. conan profile update settings.compiler.libcxx=libstdc++11 default
  7. conan config set general.request_timeout=300 our gitlab can be very slow for huge packages
  8. Create api read token
  9. conan remote add just-simple-cmake https://gitlab.cc-asp.fraunhofer.de/api/v4/projects/34353/packages/conan
  10. conan user -r "just-simple-cmake" -p "gitlab_api_read_token" "randomUser"
  11. save line 10 in a conan-relog script in PATH, our gitlab needs sometimes a relog and this makes it way more handy.

how to test normal build?

  1. install conan recipes
    • The current recipes for llvm / wali used are not merged to conan center, therefore we need in install them in our local cache.
    • In the future this shouldn't be necessary, either github supports conan directly or our group could set up a conan artifactory to also share prebuild packages.
    • If you added the repository above, go to step 2
    • If you didn't add the repository ./utils/conan/install_recipes_to_local.sh
  2. cmake --preset debug
    • will build all dependencies according to used conanfile and recipe defaults (full llvm also!)
  3. cmake --build --preset debug
    • will build phasar in release / static build
  4. ctest --preset debug
    • will run all tests and also set jobs/--output-on-failure
    • variants:
      • ctest --preset debug -R IDETSAnalysisOpenSSL
      • ctest --preset debug -L phasar-llvm

Available preset for all stages are:

Phasar in tree build?

what is missing?

vulder commented 1 year ago

@jusito please give me a ping shortly before this is merged so I can run a final integration test with the phasar in-tree build

janniclas commented 1 year ago

@jusito we should also update our GitHub workflows to work with the new build system right? If you do this in the GitHub actions I guess I can reproduce what you do there for the Dockerimages to at least get this off your hands. Just ping me if you need anything for this, but I guess you are also familiar with those things right :)

jusito commented 1 year ago

As update, conan 2.0 is out so I can continue on this. In essence the cmake integration changed in way I have to rethink a bit. Already looked into different solutions in january and it should be fine. Also had a look into install part where the config.cmake.in needs some time, but after that should be fine. Iam planning to invest some time in april.