C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(312,5): error MSB3491: Could not write lines to file "emscripten-optimizer.dir\Release\emscript.56D14EB4.tlog\emscripten-optimizer.lastbuildstate". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. [C:\Users\steve\src\rust\build\x86_64-pc-windows-msvc\stage0-rustc\x86_64-pc-windows-msvc\release\build\rustc_binaryen-61bb35785797f73f\out\build\src\emscripten-optimizer\emscripten-optimizer.vcxproj]
My rust checkout, as you can see, is in C:\Users\steve\src, which is pretty short.
Any ideas on what to do here?
What command are you running, and what is the config.toml? (I wonder why Emscripten is involved)
What command are you running, and what is the config.toml?
In this case, python x.py test src\tools\linkchecker, though it never gets to that part.
[build]
build = "x86_64-pc-windows-msvc"
host = ["x86_64-pc-windows-msvc"]
target = ["x86_64-pc-windows-msvc"]
(I wonder why Emscripten is involved)
I'm guessing it's because this is my first build after https://github.com/rust-lang/rust/pull/45905 landed. I also did an rm build to fully build from scratch and it still happens.
C:\Users\steve\src\rust\鈥emscripten-optimizer.vcxproj has 198 chars, if emscripten-optimizer.dir\鈥emscripten-optimizer.lastbuildstate is placed in that directory we'll get ...
C:\Users\steve\src\rust\build\x86_64-pc-windows-msvc\stage0-rustc\x86_64-pc-windows-msvc\release\build\rustc_binaryen-61bb35785797f73f\out\build\src\emscripten-optimizer\emscripten-optimizer.dir\Release\emscript.56D14EB4.tlog\emscripten-optimizer.lastbuildstate
which has exactly 261 characters. (The question is why is such a deep hierarchy is created in the first place...)
@steveklabnik Try to rename C:\Users\steve\src\rust to C:\Users\steve\src\rs and see if it can be worked around for now?
Yes, that is working. Sigh.
So, I guess the question is, what should we actually do here?
Our path limits change from time to time, often requiring shorter and shorter prefixes. Eventually we won't have to deal with this at all as we won't be building binaryen but in the meantime I think the only recourse is to use a shorter prefix (e.g I personally use C:\msys64\code\rust and the CI bots use C:\projects\rust)
Eventually we won't have to deal with this at all as we won't be building binaryen
Seems fine then, let's just leave it. Hopefully my muscle memory will adjust, heh.
Is it possible to get rid of the 260-char limit in rustbuild through those \\?\stuff paths as mentioned in rust-lang/rfcs#2188?
This is really annoying 馃槥
Here's the relevant MSBuild issue: https://github.com/Microsoft/msbuild/issues/53
Looks like it is making progress, albeit slowly...
Somebody else found a "workaround" for this issue: http://conanio.readthedocs.io/en/latest/reference/conanfile/attributes.html?highlight=short_paths#short-paths
It involves creating a temporary link from the drive root the build folder and invoking msbuild from there. Presumably something similar could be done here?
Also, can we keep this issue open? Given that pretty much everyone who tries to build rust on windows is likely to hit it, it seems pretty important and should be easily discover-able.
Why is the Emscripten backend even being built if I have this in my config.toml?
[rust]
codegen-backends = ["llvm"]
Binaryen has since been removed, so closing.
I am a little late but you can try
$ mklink /J c:\fruit c:\apples\bananas\oranges
Most helpful comment
Yes, that is working. Sigh.
So, I guess the question is, what should we actually do here?