-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
MSVC / wrapper script bug: cannot compile files with long path #2406
Comments
Workaround is to use |
For you maybe, but even that does not help on our codebase. |
Two questions then:
|
...and pass |
Does not work for me:
|
You may need to restart MSYS. |
Done
Is in. |
Shouldn't need admin rights, or do you mean something else? |
And what's the command line you're running? |
Now manually created
and given
Leads to:
|
Ah, yes, that is a known issue I'm fixing today or tomorrow. |
For now what I can recommend is try disabling your antivirus for the first Bazel run. |
I suspect the reason is, as we extract the embedded binaries into the temp install directory, the AV starts scanning them, acquiring and holding file handles to them. |
Disabled as much as I could - still same error message. Might be that some part of antivirus is still running, though. |
Hm, can you try this:
Then apply this patch:
then build bazel, and see whether this solves the renaming issue? |
Perhaps lets rather do that at FOSDEM then? |
Sure. |
Using junction seems to work with 0.4.4. Seems like 855fbe9 was not the best version to pick. |
I hit this bug again today, again the |
@laszlocsomor on track fro 0.5? |
Yes! |
I have a change that fixes about 5 long path related bugs. Now I can build bazel with a long output_user_root. Yay! |
Ok, I was testing more with longer paths and found a couple things:
|
With regards to "general" handling, I would rather have a special commandline flag where you can tell Bazel to pass shortened label paths to a certain Mnemonic. Everything else is up to the action implementation. Actually most of our actions e.g. are working fine with prefixed paths. |
What do you mean? Can you show an example? |
I was thinking about in
in
where inputs gives you a IF we want a "workaround" (for third party binaries that cannot handle long paths (WTF)), I would be rigorous and force users to provide a drive where Bazel can create a junction. Something like |
It's actually desirable that actions don't get an absolute path for inputs [1] because this way the execroot can be anything, enabling actions to be reproducible and deterministic, regardless of the machine or the execroot path they run under. Every action has a working directory (AFAIK this is always the execroot), and all their inputs are available as relative paths underneath it. Requiring an output drive [2] is a promising idea, but doesn't solve the problem of having packages that are several directories deep and have longish names, because then your paths are execroot + longish package name + file name, easy to reach the 260 char limit. And then there are actions like C++ compilation where you could have a cc_library "//foo:lib" with two sources "//bar:a.cc" and "//baz:a.cc", so And finally there's the problem that it's not only third-party software not supporting long paths, it's Microsoft's own C++ compiler too. This means we cannot rely on the action to handle long paths, we have to run the action under a short root with short input/output paths. So I think using junctions is the direction we need to go in. [1] therefore also not a shortened path, nor a \\?\-prefixed one |
Fixed by #2181 ...? |
No, unfortunately not. |
Lowering the priority of this, as this is cl.exe's issue. |
@laszlocsomor Do you want to answer https://twitter.com/apardoe/status/873212726968856578? |
@abergmeier : Here's a repro: https://gist.github.com/laszlocsomor/720f9c739a0c825896a3b33473255f33 |
Thx. Passed that along. |
This will definitely not be done until 0.6, and in all honesty I doubt it'll become a priority at all before 1.0... so I'm marking this as 1.0 for now. |
related: #4149 |
Closing this in favour of #4149. That bug also deals with C++ compilation of files with long paths. |
Description of the problem / feature request / question:
If the default or user-specified
--output_user_root
is too long, then Bazel cannot compile//third_party/protobuf/3.0.0:protoc_lib
which has a long path:If possible, provide a minimal example to reproduce the problem:
Then take that binary and run this build:
Its output is:
Environment info
Operating System: Windows 10
If
bazel info release
returns "development version" or "(@non-git)", please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD
):The text was updated successfully, but these errors were encountered: