-
Notifications
You must be signed in to change notification settings - Fork 115
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
Windows! #8
Comments
Just to leave a quick note while I am researching this:
|
Hi, @lummax! Thanks for diving in here. Looks like good stuff to me. Tapping back some thoughts, in case they're helpful.
Couple other notes from my mental cache that might be handy:
If there are other things where I could save you a bundle of time by answering questions or otherwise helping orient you in the code, please let me know. Communication lines are open, and I really appreciate your efforts. |
I would like to avoid that. We are experimenting with using a vendored compiler toolchain where the complete configuration is already statically known in our
It seems the search paths should be passed via environment variables. If these environment variables are not set header-extraction in
|
A completely different finding: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/main/java/com/google/devtools/build/lib/rules/cpp/ShowIncludesFilter.java#L58 When extracting the included headers from the |
Gross. At least they all seem to end with a colon (58)? Still tough especially if it makes you recognize them in stderr. (Ah! Didn't realize it was specific to refresh.template.py header finding. Clangd does indeed do some detection from the structure of known compilers. Hoping you find that the aquery output has the environment variables you need!) |
Hi, I am happy to help make it work on Windows, and I init a PR to do so #25 . And I'd like your help to figure out what else needs to be added there. For now there are some known issues while using Bazel on Windows:
|
Wow--should I be so lucky as to have not one, but two efforts to add Windows support! @LoSealL, thanks for your efforts and contribution. @lummax, though, is already quite far along with his work to add Windows support, including solving issues you raise. We're working on merging in the first part of his fix in #16, the other open PR, which moves everything into python so windows doesn't need a separate bat file! If I may, and you'd still like to help, could I ask that you join forces? Perhaps there's a part where he'd like some help. |
Oh, I'm not aware @lummax is working on Win support, just seeing a refactor PR opened. Thanks you for your reply. |
Sorry, I was slow to respond on the refactoring PR. We are running https://github.com/axivion/bazel-compile-commands-extractor/commits/axivion (ignore the ugly git history) on Windows. Feel free to give that a try. |
Hi @lummax, thanks for your great effort!
|
The include arguments for external packages are not correct {
"file": "src/foo.cc",
"arguments": [
"\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe\"",
"--language=c++",
"/nologo",
"/DCOMPILER_MSVC",
"/DNOMINMAX",
"/D_WIN32_WINNT=0x0601",
"/D_CRT_SECURE_NO_DEPRECATE",
"/D_CRT_SECURE_NO_WARNINGS",
"/bigobj",
"/Zm500",
"/EHsc",
"/wd4351",
"/wd4291",
"/wd4250",
"/wd4996",
"/I.",
"/Ibazel-out/x64_windows-fastbuild/bin",
"/Iexternal/gtest",
"/Ibazel-out/x64_windows-fastbuild/bin/external/gtest",
"/Iexternal/bazel_tools",
"/Ibazel-out/x64_windows-fastbuild/bin/external/bazel_tools",
"/Ibazel-out/x64_windows-fastbuild/bin/spdlog/include",
"/Ibazel-out/x64_windows-fastbuild/bin/fmt/include",
"/Iexternal/gtest/googlemock",
"/Ibazel-out/x64_windows-fastbuild/bin/external/gtest/googlemock",
"/Iexternal/gtest/googlemock/include",
"/Ibazel-out/x64_windows-fastbuild/bin/external/gtest/googlemock/include",
"/Iexternal/gtest/googletest",
"/Ibazel-out/x64_windows-fastbuild/bin/external/gtest/googletest",
"/Iexternal/gtest/googletest/include",
"/Ibazel-out/x64_windows-fastbuild/bin/external/gtest/googletest/include",
"/DSPDLOG_FMT_EXTERNAL",
"/DSPDLOG_WCHAR_TO_UTF8_SUPPORT",
"/DSPDLOG_WCHAR_FILENAMES",
"/showIncludes",
"/MD",
"/Od",
"/Z7",
"/wd4117",
"-D__DATE__=\"redacted\"",
"-D__TIMESTAMP__=\"redacted\"",
"-D__TIME__=\"redacted\"",
"/MT",
"/Fobazel-out/x64_windows-fastbuild/bin/src/_objs/foo/foo.obj",
"/c",
"src/foo.cc"
] For example the |
Just merged @lummax's first PR! Thank you so much, Lukas! @LoSealL, to respond to your three:
|
@cpsauer |
@cpsauer I see you have a new For vcvars, you can refer to |
hi there! I'm yet someone else interested in making this work on windows 🙂. I'm myself a windows newbie (I do my development in linux), but I'm the resident bazel expert of my cross-platform team and I want to help them out with IDE integration. Ok, with presentations out of the way, I've tried the axivion:basic-windows-support branch out (with MSVC), and it mostly worked but for one small wrinkle: some of the include flags were spelled I can definitely look into it, but maybe someone of the participants to this conversation already knows what's going on there? |
Hello, thanks for giving this a try :) I did not notice something like that before. But as you, I am a Linux guy that is "the resident bazel expert of my cross-platform team" and I feel you. Could this be due to some |
indeed! nice catch! yes, I do have explicit It might be worth though replicating that magic in the compilation database extractor maybe |
So I'm not sure if this is a clangd issue, a VSCode issue, or an issue with the extractor or with Bazel, but for me, clangd isn't finding headers in directories specified with This happens with both llvm 13 and 14. I was also wondering what the equivalent path for |
uh, that's weird, as for me it's the other way around... what compiler is it showing to use in the compilation db? I'm using CLion, so that might be a difference?
I did not have such an issue (but maybe I used |
Hey, all! Merge of @lummax's good work coming shortly (should be tm). I've added some auto-junctioning and auto-git-ignoring goodies that should automate away all the manual stuff around the link, and still have it work automatically cross-platform. More tomorrow :) |
The compiler is cl.exe, BUT, I tried the same compile_commands.json in CLion and it complained about the string
The path works in Git bash, but not in Powershell/cmd, so the link can be set that way. |
Friends, we're merged! Please grab the latest commit, and let us all know what you think. With the main part unblocked, it's incremental improvement time. Huge thanks to @lummax for laying the Windows foundation and getting this rolling. To make onboarding smoother and things more robust, I've added to his great work the auto-junction and auto-gitignore stuff mentioned above. There's also some additional Bazel toolchain robustness and a grab bag of miscellaneous fixes--all merged together. To that end, you'll want to un-commit the //external symlink. First, unlink. Then stage. Then rerun the tool and let it patch your gitignore. Then stage and commit! |
As part of all that, I resurrected an old, childhood Windows desktop and provisioned it for development. Looks like lots of us are in the same boat, cross-platform Bazel folks venturing together into windows |
I'm going to close this down for now, so we don't confuse people, but let's continue discussing the Also, hi @redsun82! Pretty cool to have a GitHub staff member here! If you're willing, I'd love to hear what you think of CLion (as opposed to, say VSCode), what brought you here, and how setup went. Same with you @Arazu161! |
Could you all bring me up to speed a little more on this I'm typing up what I'm putting together as I read. Please correct me if I'm wrong!
If that's right, would you guys be down to work together to track down what's breaking and report it to clangd? Those folks are really great. And then, a workaround until their next release, it's pretty easy for us to do "magic" patches. We can just add a LMK what you think, or if I'm on the wrong track. |
I've changed over to the latest commit, and the issue is still there. It seems to be a quoting problem, CLion complains about Changing the path in the command to A quick test with neovim showed the same problem I would this is a clangd issue. I'm not familiar with the it's codebase, but from what I can see it expects single quote strings to be escaped, which isn't valid JSON (and on a quick test it looks like I've opened an issue on clangd (clangd/clangd#1094) but, for general compatibility I feel like it would be better to specify the path with escaped double quotes ( |
Just to echo what I said on the clangd issue, the llvm libraries try to emulate the way that the platform's shell would parse this string, and cmd.exe doesn't support single quotes. If you want to avoid quoting issues, setting the |
Thanks @sam-mccall and @Arazu161 tracking it down and being great. Really appreciate you both. Arguments array it is. Just pushed a fix. Bazelers, could you update and check that this works for you, too? |
Yes, the |
Try the latest 😉 |
Looks good to me so far, thanks for putting in the work! |
Update: Windows support landed! Thanks all. The latest commits should have it. You can go ahead and start using this tool on Windows.
We haven't yet tested on Windows. Windows might need some patching parallel to that for macOS (in refresh.template.py), but it should be a relatively easy adaptation compared to writing things from scratch. If you're trying to use it on Windows, let us know here. We'd love to work together to get things working smoothly.
The text was updated successfully, but these errors were encountered: