zyantific / zydis-rs

Zydis Rust Bindings
MIT License
83 stars 14 forks source link

zydis-rs fails to build on windows from github #13

Closed williballenthin closed 6 years ago

williballenthin commented 6 years ago

Using the basic example shown in the readme on linux, zydis-rs builds and links just fine (with dependecy zydis = { git = "https://github.com/zyantific/zydis-rs"}):

image

However, on Windows/Visual Studio, the example fails:

image

image

I believe this is because on Windows, cmake builds the zydis-c static libraries in a subdirectory named after CMAKE_BUILD_TYPE, eg. Build. On linux, the static libraries are placed into the root build directory.

See this is the build root, and Zycore.lib is not found:

image

but is placed in ./Debug/:

image

and likewise for Zydis.lib.

As I'm still fairly new to rust and not familiar with the cmake crate, I'm not sure if this is common behavior. I'll make an attempt to update build.rs to autodetect Windows/Visual Studio and fix the build path; though, you may have better ideas for a fix.

williballenthin commented 6 years ago

Oh, the project links just fine if I manually copy Zycore.lib (and Zydis.lib) into the build roots and re-run the build, demonstrating its simply the above path confusion.

image image

williballenthin commented 6 years ago

closed in #14