qir-alliance / qat

QIR compiler tools and optimization passes for targeting QIR to different hardware backends
https://qir-alliance.github.io/qat/
MIT License
26 stars 14 forks source link

Windows build issue: "Cannot open the binary to read launch data" #151

Closed chemix-lunacy closed 1 year ago

chemix-lunacy commented 1 year ago

Followed the Bazelisk build instructions. Had to use a slightly modified command line because my default user folder has a space in it:

bazelisk --output_user_root="C:\Users\Default\bazelisk" build //qir/qat:qat --config msvc --config release

Fixed a variety of small environment setup issues, but then end up with this error:

bash.exe failed: error executing command
cd /d C:/users/default/bazelisk/a7tojsoq/execroot/microsoft
SET PATH=... 
SET RUNFILES_MANIFEST_ONLY=1

C:\Windows\system32\bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/qir/qat/VersionBuilder.exe bazel-out/host/bin/qir/qat/workspace.txt qir/qat/Version/Version.tpl.hpp bazel-out/x64_windows-fastbuild/bin/qir/qat/Version/Version.hpp
# Configuration: e79f7d451c97d5663ceb5bde06780c688e3255310be50fac34b57c1edb492a0c
# Execution platform: @local_config_platform//:host
LAUNCHER ERROR: Cannot open the binary to read launch data
LAUNCHER ERROR: Failed to parse launch info.
Target //qir/qat:qat failed to build

Just omitting the path for succinctness, can provide if necessary. Every file referenced in the bash command exists except the Version.hpp which I assume is the output. I'm on a relatively standard windows 10 home dev machine.

Any pointers to help find out what's going wrong?

swernli commented 1 year ago

hi @chemix-lunacy sorry for the delayed follow up. Have you been able to get the components to build on your Windows machine in the meantime? Any advice you can share that has helped your set up?

For my part, I use the devcontainer in the repo to work on the code in a Linux environment where building via cmake is much easier. If you are unfamiliar with container workflows, check out this guide on Developing inside a Container using VSCode. Hope that helps!

chemix-lunacy commented 1 year ago

@swernli I didn't spend any additional time and the container is a no-go.

Don't suppose the builds are cross-platform now or you've got binaries for all the main ones?

swernli commented 1 year ago

@chemix-lunacy Unfortunately, while the CI build does test on Windows, it doesn't produce any binary artifacts, so there is nothing to download from there. I did take a crack at getting cmake compilation on Windows supported and I have something that works locally on my machine. I've pushed that up to a working branch here: https://github.com/qir-alliance/qat/tree/swernli/windows-cmake. It's hacked together, but I'd appreciate feedback on whether this works on your system as well as mine. Some caveats:

For me that worked. Let me know what you are able to reproduce, and I'll keep trying to refine this into a state where it is more broadly consumable.

chemix-lunacy commented 1 year ago

@swernli Ah, thanks so much for jumping on this and trying to fix it up! But I have no problem with waiting for binaries and when things are more stable. I also likely won't get around to testing it, sorry.

Funnily enough since you mentioned it, I've already spliced together a Rust project from both qir-runner and pyqir that gave me a foundation for doing everything I needed to do anyway. So thanks a ton for those!

If you're making it work with just normal cmake it may be worth just closing this issue as it's likely a bazelisk problem.

swernli commented 1 year ago

Glad to hear qir-runner and pyqir are working well for you! I'll go ahead and close this for now as bazel-specific as you suggest. I think unblocking a simpler cmake path will be the best way forward.