Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcpkg integration #128

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft

vcpkg integration #128

wants to merge 31 commits into from

Conversation

ekilmer
Copy link
Collaborator

@ekilmer ekilmer commented Jul 6, 2022

This is a rough integration for usage of vcpkg dependencies. You can build like the following on Linux or macOS:

git clone https://github.com/microsoft/vcpkg
export "VCPKG_ROOT=$(pwd)/vcpkg"
cmake --preset=dev
cmake --build --preset=dev
ctest --preset=dev

and it should work but tests might not pass on Mac because of LIEF upgrade.

You can also attempt to build on Windows (after merging and fixing a few things in #97, see #97 (comment) for more details) with the following

git clone https://github.com/microsoft/vcpkg
$Env:VCPKG_ROOT = "$PWD\vcpkg"
cmake --preset=dev-win64
cmake --build --preset=dev-win64 # Will likely fail due to some Maat bugs
ctest --preset=dev-win64 # Will almost certainly fail

Also, for the dev preset, you can have something like this file as CMakeUserPresets.json in the root of maat.

{
    "version": 2,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 15,
        "patch": 0
    },
    "configurePresets": [
        {
            "name": "dev-common",
            "hidden": true,
            "inherits": [
                "dev-mode",
                "vcpkg"
            ],
            "cacheVariables": {
                "Python3_FIND_UNVERSIONED_NAMES": "FIRST"
            }
        },
        {
            "name": "dev-unix",
            "binaryDir": "${sourceDir}/build/dev-unix",
            "generator": "Ninja",
            "inherits": [
                "dev-common",
                "ci-unix"
            ],
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": "Debug"
            }
        },
        {
            "name": "dev-win64",
            "binaryDir": "${sourceDir}/build/dev-win64",
            "inherits": [
                "dev-common",
                "ci-win64",
                "vcpkg-win64-static"
            ]
        },
        {
            "name": "dev",
            "binaryDir": "/tmp/work/build/dev",
            "inherits": "dev-unix"
        }
    ],
    "buildPresets": [
        {
            "name": "dev-win64",
            "configurePreset": "dev-win64",
            "configuration": "Debug",
            "jobs": 8
        },
        {
            "name": "dev",
            "configurePreset": "dev",
            "configuration": "Debug",
            "jobs": 8
        }
    ],
    "testPresets": [
        {
            "name": "dev-win64",
            "configurePreset": "dev-win64",
            "configuration": "Debug",
            "output": {
                "outputOnFailure": true,
                "verbosity": "verbose"
            },
            "execution": {
                "jobs": 1
            }
        },
        {
            "name": "dev",
            "configurePreset": "dev",
            "configuration": "Debug",
            "output": {
                "outputOnFailure": true,
                "verbosity": "verbose"
            },
            "execution": {
                "jobs": 1
            }
        }
    ]
}

TODO:

Things I can think of now...

  • Use vcpkg in CI for native builds
  • Use vcpkg in Python builds. Not sure how difficult it will be with cibuildwheel. By default we still want someone to use local dependencies in the event that someone wants to install the package from a git commit (i.e., using a GitHub repo URL)
    • Ideally vcpkg works for cross-compilation of Mac architectures. This will be a real test of vcpkg
  • We will need a custom vcpkg triplet for adding Mac compatibility flags for the vcpkg dependencies
  • Merge the changes required of sleigh into master branch CMake refactor lifting-bits/sleigh#105

@ekilmer ekilmer force-pushed the ekilmer/vcpkg-integration branch 2 times, most recently from e72d8f0 to fda0365 Compare July 7, 2022 01:14
ekilmer added 4 commits July 7, 2022 09:08
Latest release
Overlay ports for projects (sleigh, lief) that don't exist in upstream
vcpkg repo and/or are required overlays (mbedtls v3) because upstream
won't accept them due to single-version package policy and mandatory
compatibility of all existing packages.

This uses a development version of sleigh that does a large refactor of
the CMake and some target names.

The lief portfile was copied from an existing PR
@ekilmer ekilmer force-pushed the ekilmer/vcpkg-integration branch from fda0365 to 3af4dbe Compare July 7, 2022 13:43
@ekilmer ekilmer changed the base branch from dev-next to master July 7, 2022 18:13
ekilmer added 2 commits July 20, 2022 15:18
TODO: We should split out the sleigh compiler tool into its own port to
support cross-compilation better. The host only needs the compiler and
not the libraries
@ekilmer ekilmer force-pushed the ekilmer/vcpkg-integration branch from 0c9becb to 425ebe3 Compare August 4, 2022 21:07
ekilmer added 17 commits August 18, 2022 16:49
Also fix LIEF compilation with newer fmt. Use old fmt instead
* master:
  Use MemMapManager to detect free space in memory instead of page permissions (#149)
  Various EVM fixes (#148)
  Bump patch version
  Expose more functionalities in python bindings (#146)
  Bump patch version
  Expose `ULE` and `ULT` to bindings (#140)
  Support KECCAK hash of empty string (0-length) data (#139)
  Bump patch version
  Add support for EVM LOG* instructions (#138)
  Various fixes for running a Smart Contract (#135)
  Various improvements to `EVM` support (#137)
  Bump patch version
  Allow to deep copy transaction objects in bindings (#133)
  Bump version
  Allow to skip the data parameter in python event callbacks (#132)
  Bump version
  Fix processing IR stores with big addresses (#131)
  Update lief to 0.12.1 (#110)
We used the wrong `python3` command compared to what CMake found
Not sure if this value is correct or not but at least it shows what the
value actually is for further debugging without reproducing
Seems that Ghidra has fixed some bugs for these instructions.

I tested other instructions that are commented but they still fail
*Not sure if these are true fixes. Found while investigating sleigh
regression
Future versions of sleigh will remove 'using namespace std;' from
headers
* master:
  Fix CI issues (#161)
  Update LIEF to 0.12.3 (#159)
* ekilmer/update-sleigh:
  Use 'std::' prefix when needed
  Fix some ubsan errors
  Fix compilation when using sleigh submodule
  Don't include LLVM version in HACKING doc
  Add back previously failing tests
  Change value for tests (unsure if correct)
  Merge latest x86 slaspec files from Ghidra 10.2.2
  Update sleigh to 10.2.2
  CI: Fix Python 3 macOS dependencies
  CI: Update clang compiler from 11 to 14
@ekilmer ekilmer force-pushed the ekilmer/vcpkg-integration branch from 28b5a35 to 893f0ee Compare March 30, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant