zyantific / zydis

Fast and lightweight x86/x86-64 disassembler and code generation library
https://zydis.re
MIT License
3.47k stars 434 forks source link

zydis's port int vcpkg is misconfigured #388

Closed XiangruLiu0 closed 1 year ago

XiangruLiu0 commented 2 years ago

I installed zydis and zycore by running vcpkg install zydis:x64-windows, but when I want to use these packages in my CMake project with find_package(zycore REQUIRED) and find_package(zydis REQUIRED), CMake report errors like this

image

And I looked into zydis's install directory, zydis-config.cmake is placed under the zydis subfolder of ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/zydis, that's why cmake can't find it.

Desired behavior: zycore and zydis should be placed separately under vcpkg's folder

image
flobernd commented 2 years ago

Hi! Thanks for reporting this.

According to our README:

The Zydis port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

I have to admit that I don't have any experience with vcpkg. I will leave this issue open for a while in case we can support resolving this problem on our side.

We recommend including Zydis as a submodule. We do provide an example in this repository: https://github.com/zyantific/zydis-submodule-example

XiangruLiu0 commented 2 years ago

I'm also not very familiar with vcpkg 🤣 that's why I didn't create a pull request directly in vcpkg's repository

XiangruLiu0 commented 2 years ago

After spending half a day on vcpkg, I figured a way to fix this issue. My idea is to add Zycore as a new port to vcpkg and declare it as Zydis's dependency, this works perfectly on my own fork of vcpkg. I have created pull requests to vcpkg, waiting for its maintainers to merge my commits 😃

flobernd commented 2 years ago

Thanks for taking care! I was under the impression that Zycore already is an independent module on vcpkg.

athre0z commented 2 years ago

Ah, nice! We originally argued against making Zycore a separate port because it neither had version numbers on its own, nor did it have any API or ABI stability guarantees. This has since changed, so making it a separate port is indeed probably for the best. Thanks for investigating and fixing this!

flobernd commented 2 years ago

VCPKG PR for reference: https://github.com/microsoft/vcpkg/pull/27195

alandtse commented 2 years ago

While this appears to resolve find_package on zycore, zydis still has the problem because it's zydis-config.cmake is in a subdirectory zydis/zydis.

The simple workaround is to copy all the .cmake files down to the root.