Windows: local-build script update#9623
Conversation
Signed-off-by: thomthehound <thomthehound@gmail.com>
Signed-off-by: thomthehound <thomthehound@gmail.com>
… into win-script-update
Signed-off-by: thomthehound <thomthehound@gmail.com>
Signed-off-by: thomthehound <thomthehound@gmail.com>
… into win-script-update
|
@thomthehound is not a repository collaborator. To proceed:
|
stsoe
left a comment
There was a problem hiding this comment.
Thank you for making windows build more user friendly. These are really great enhancements.
I was experimenting with this myself, I wanted to create a separate repo that managed and built the vcpkg dependencies, but I actually like what you are doing here.
Few comments though.
I think you are building vcpkg dynamic dependencies by default?One requirement is that XRT links statically with all external dependencies. I believe this would eliminate the stage option. If someone insists in building with dynamic dependencies, then sure we could accommodate that, but the default build has to link statically with vcpkg dependencies (minus OpenCL.dll of course). Now, I am fully aware that the CI scripts I added yesterday also use dynamic dependencies, and I need to fix that at some point.
Secondly, default building vcpkg dependencies as part of the build is going to drive novice developers crazy. They will forget to supply the -ext argument pointing to a pre-built area and instead incur excessive long build times. I'd much rather reverse the logic, and stick with a fixed pre-populated ext-dir by default. I would prefer special explicit switch for invoking the vcpkg part of the script.
I like how you pin the vcpkg hash XRT. It has long bothered me that ext.new doesn't reflect the sources used to build the external dependencies, so if we reverse the logic to point at a pre-popuated ext-dir backed into build26.bat. then maybe this directory should carry the hash of vcpkg in its name ext.vcpkg.<hash>?
Thank you for your kind words and for taking the time to look at this, Soren. It is always my pleasure. I agree with what you are saying about static vs. dynamic linking. I actually wasn't doing that to mimic you: this was a habit of mine due to an old bug I ran into while working on the Windows bring-up for mlir-aie. I'll try to track down again where the specific problem was so I can jog my memory, but I believe it had something to do with
I think I see what you are driving at with preferring pre-packaged dependencies, so I can arrange to reverse the logic. In fact, I had anticipated you might say something like that. It just did not seem reasonable for me to act on that assumption in the initial PR. Would expecting the packages to be in
I'm glad you like the hash. I was worried I was going too far with that, but I was also bothered by the same thing. I think I might need to change the location of the dependency staging directory if we include the hash in the name, though. From my experimentation, it appears I've already started to approach the maximum safe path length on Windows, and the hash is long. Perhaps I can see what happens if I include only the first ~7 hex digits, as they appear on GitHub. I'll try to get this done as quickly as possible, but it is likely to take me at least a couple of days to draft the requested changes. |
Signed-off-by: thomthehound <thomthehound@gmail.com>
|
@thomthehound is not a repository collaborator. To proceed:
|
|
@stsoe, sorry about the wait on this. Some things came up. I believe I have implemented the changes you requested: (1) Dependencies and the build script use the static triplet by default
(2)
This was chosen because (A) it can be reasonably expected that the user would not run (3) In the interest of keeping things tidy and not overly complicating the scripts, If you want the directories themselves named, I can still do that, but I think this is the cleaner option. Usage remains the same: Of course, we can always just tell users to "Install the dependency package into C:\Xilinx\ext.new and then run Note: I think I have found a bug when building xbtracer with static dependencies on Windows. I am going to look into this further. |
|
Thank you @thomthehound . This looks really good. I will take it for a spin to familiarize myself with the scripts and options you have added. |
I'm glad to hear it! If you have any other requests of me, please do not hesitate to ask. While you are testing, just be aware that, right now, it only builds xbtracer without error if dynamic protobuf is used. Obviously, it will not even try to build xbtracer if you don't pass |
|
Hi @thomthehound . Do you mind rebasing this PR against latest master to pull in #9633 along with other changes? |
|
@thomthehound is not a repository collaborator. To proceed:
|
|
@stsoe Should be good to go now. |
Co-authored-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
|
@thomthehound is not a repository collaborator. To proceed:
|
|
How interesting. Accepting a suggested change causes the DCO to fail. I would have thought that me being signed in would count as signing the commit. |
Hmm, yes, but all commits have to be individually signed off. This is a little painful. |
|
@thomthehound is not a repository collaborator. To proceed:
|
|
Hi @thomthehound . I've not been successful with xrtdeps-vcpkg.bat. Right now I forget what error I got, but it was somewhere deep on vcpkg. Does it run from a clean state for you? There are few additional complications. We need OpenCL dependency created as x64-windows dynamic, copied to same install area as all the static libraries. Also, we need protobuf, which I can't get vcpkg to build. I am worried about the vcpkg automation in build26.bat. I don't really want to support this when our developers run into problems, or decides to build their own dependencies, which then maybe don't work. For our developers, I much prefer a central area managed by our DevOps. To that extend, I am leaning towards a separate repo, that builds dependencies with vcpkg as much as possible, then maybe special cases whatever vcpkg can't build. For external folks, this could be documented as they way to build XRT dependencies. My WIP is here: https://github.com/stsoe/xrtdeps-vcpkg. |
Thank you again for taking the time to review this, Soren, and also for sharing your WIP repo. That makes the direction you want much clearer. I have tested For OpenCL, I can replicate in I think I better understand your concern now about Part of why I ended up splitting the difference here is that I have previously had patches held up because codeowners wanted scripts I'd written for the CI to also be convenient for end-users on desktop systems. But I understand the maintenance concern (and I agree with you). Now that Windows is going to get distribution support, there is much less need for users to build everything locally. I will revise the patch accordingly. This may take me a few days to rework and retest. |
|
@thomthehound is not a repository collaborator. To proceed:
|
Signed-off-by: thomthehound <thomthehound@gmail.com>
|
@thomthehound is not a repository collaborator. To proceed:
|
I have still not been able to replicate an error in building protobuf. In addition to my other tests, I have removed all development tools from my secondary machine, nuked all caches, completely removed any instance of vcpkg anywhere, and re-installed with the bare minimum VS 2022 Build Tools, and it has still worked for me. However, I just tried an absurdly long path length for the build, and that did fail in the |
|
@stsoe one other possibility, if you are saying you've never been able to build protobuf specifically from the Windows CI runner is that you might be getting bitten by the Ninja 1.13.0 response file parsing bug. The best way around that is to use the |
|
It appears that deprecation warnings issued after #9651 may be breaking Windows builds in I do not think these warnings should be suppressed. I am setting aside some time to migrate the remaining I'm considering leaving a small shim through the non-deprecated C bindings (with a deprecation warning issued through Python) so anything downstream still using |
@chvamshi-xilinx @karthdmg-xilinx FYI, I thought we have had fixed the deprecation warnings in our own code? It's premature to deprecate APIs we are using. |
Hi @stsoe , |
As this PR is a follow-up to #9541 (and additionally related to #9618), I would appreciate review by @stsoe.
Problem solved by the commit
The existing build scripts for Windows are CI-focused and not friendly for external users who may want/need to install XRT on their local machine. Additionally, the existing dependency installation scripts are outdated and do not function as expected for end-users. As more Ryzen AI NPU projects come online, these barriers to entry become more pronounced.
This patch aims to fill that gap by providing Windows desktop users a more turn-key path that "just works", while also being CI-compatible and without disrupting existing workflows.
Usage instructions (from repo root):
How problem was solved
This patch adds two new scripts (both support
-help) and patches two CMakeLists.txt files:src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat<repo>\build\ext.vcpkg(or other directory specified by-extroot).src/vcpkg.json, but may be optionally extended with the-portflag to include, e.g., protobuf so thatxbtracercan be built.-baselineflag) to avoid breakages from upstream changes. This was chosen to ease long-term maintenance.pybind11viapipforpyxrt.build/build26.bat:build/build22.bat. Accepts the same arguments, plus:-ext <path>: dependency prefix root (e.g. a vcpkg_installed<triplet> directory generated fromsrc/runtime_src/tools/scripts/xrtdeps-vcpkg.bat)-install [<prefix>]: install to a specified location (default C:\Xilinx\XRT; if omitted, installs to the build tree, identically tobuild22.bat)-stage: copy the minimal subset of necessary runtime DLL's into <install_prefix>\ext\bin (currently Boost filesystem/program_options and optional protobuf DLLs)-rwd: build RelWithDebInfo configuration.-arm64: build for ARM64 architecture (requires first setting-triplet arm64-windowsfor vcpkg dependencies inxrtdeps-vcpkg.bat)Minimally modifies
src/runtime_src/tools/xclbinutil/CMakeLists.txtto no longer force gtest to be installed in a hardcoded directory.Minimally modifies
src/python/pybind11/CMakeLists.txtto enable debug/relwithdebinfo builds to find and link the correct Python libraries on Windows.Alternatives considered / rejected
src/runtime_src/tools/scripts/xrtdeps-win*.pybuild/build.batbuild26.batfilenameRisks (if any) associated with the changes in the commit
Very low:
build26.bat/xrtdeps-vcpkg.bat); changes to existing scripts only fix (Windows-gated) bugs and do not add/remove features.build26.batdiffers frombuild22.batonly in that it does not automatically generate a zip file (-sdkshould still create one).What has been tested and how, request additional testing if necessary
And several other variations of the above, with and without
-stage,-ext, and-install(and accompanying optional directory prefix) to verify that the flags are working as expected and without order dependencies. Additionally tested with and without protobuf ports to verify that the optional port extension is working as expected.build\WRelease\runtime_src\tools\xclbinutil\Release\xclbintest.exe --resource-dir src\runtime_src\tools\xclbinutil\unittests\test_data. All tests are green:-sdkflag) was tested, but WiX packaging has not been validated. It was, however, directly carried over frombuild22.bat.Documentation impact (if any)
None in this PR. The new scripts provide some self-documentation via
-help. However, additional documentation can be added if desired/required.