-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix rust bindings build on windows #1584
Conversation
Hello, the Windows rust build is indeed broken these days and I'm trying to fix it.
Yes, ninja is better in this case but still I don't think you can really build out of VS prompt.
Exactly. It's controlled by an environment variable for now and not ideal I admit. |
Another consideration of not using ninja is that ninja is not shipped with MSVC while msbuild absolutely will. |
ninja will be present if cmake is, so it's not a problem for msvc/VS. To be clear, with my changes i can build my project (which depends on unicorn-engine) cleanly, and not have to start VS environment manually. |
It looks like current version of this PR will work fine if I just make it fallback to cmake's default generator if ninja isn't found. That would solve all the problems i've listed, while still keeping the matrix of CI builders happy. IDK about things that are not in CI (like mingw on msys2). |
ee11802
to
d0cad65
Compare
sorry, i had a goof, it should actually work now..i think |
crate is based in repo root now
silences harmless cmake warning
it should be ready to go now |
Looks good to me! I really appreciate your work and it could be merged once I test it locally. Thanks! |
Btw, I notice that the base windows environments provided for GitHub actions already include all the tools you use (msbuild,cmake,ninja,etc) : windows server 2022. Additionally it includes older versions of the tool chains (you can target vs2019, vs2022, etc ) from same image. So, your ci flow can be sped up a little by skipping some steps which are redundant (not for this pr, tho) |
Yes, the CI setup is quite old and can be optimized in many ways but that's not prioritized too much for now. |
Some things I noticed while trying to get unicorn-engine to work on windows/rust:
First I just tried
and I got
This (IMO) is kind of nonsense error. because the problem was really that it could not find cmake.
OK, so I run
"c:\Program Files\Microsoft Visual Studio\2022\Community\vc\Auxiliary\Build\vcvarsall.bat" x64
and try again:ok...so I head to this github and see that there are related changes in
dev
branch, so I do this:but still get
and, interestingly, checking in
target\release\build\unicorn-engine-2c01a69f559d00b5\output
, I see:This means that build.rs of unicorn has downloaded tarball of master branch even though it's executing from dev branch checkout (note
c10639f
in the path). fwiw this is problematic even when checking out dev branch of unicorn manually and usingunicorn-engine = { path = "unicorn/bindings/rust" }
So...:
UNICORN_LOCAL
, clean build tree, and retry to get it working, which IMO is kinda gross.This PR at least makes it build, but doesn't really fix the above problems.
What it does:
cmake --build . --parallel
to have cmake automagically do the build, which should work everywhere. (this is handled bycmake
crate)rustc-link-search