Skip to content
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

Can no longer build on Windows due to paths being too long #46113

Closed
steveklabnik opened this issue Nov 20, 2017 · 12 comments
Closed

Can no longer build on Windows due to paths being too long #46113

steveklabnik opened this issue Nov 20, 2017 · 12 comments
Labels
C-bug Category: This is a bug. O-windows Operating system: Windows T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Comments

@steveklabnik
Copy link
Member

steveklabnik commented Nov 20, 2017

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?

@kennytm kennytm added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. O-windows Operating system: Windows and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 20, 2017
@kennytm
Copy link
Member

kennytm commented Nov 20, 2017

What command are you running, and what is the config.toml? (I wonder why Emscripten is involved)

@steveklabnik
Copy link
Member Author

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 #45905 landed. I also did an rm build to fully build from scratch and it still happens.

@kennytm kennytm added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 20, 2017
@kennytm
Copy link
Member

kennytm commented Nov 20, 2017

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?

@kennytm kennytm added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label Nov 20, 2017
@steveklabnik
Copy link
Member Author

Yes, that is working. Sigh.

So, I guess the question is, what should we actually do here?

@alexcrichton
Copy link
Member

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)

@steveklabnik
Copy link
Member Author

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.

@kennytm
Copy link
Member

kennytm commented Nov 20, 2017

Is it possible to get rid of the 260-char limit in rustbuild through those \\?\stuff paths as mentioned in rust-lang/rfcs#2188?

@Diggsey
Copy link
Contributor

Diggsey commented Dec 16, 2017

This is really annoying 😞

Here's the relevant MSBuild issue: dotnet/msbuild#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?

@Diggsey
Copy link
Contributor

Diggsey commented Dec 16, 2017

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.

@abonander
Copy link
Contributor

Why is the Emscripten backend even being built if I have this in my config.toml?

[rust]
codegen-backends = ["llvm"]

@alexcrichton
Copy link
Member

Binaryen has since been removed, so closing.

@reyou
Copy link

reyou commented Apr 26, 2019

I am a little late but you can try

$ mklink /J c:\fruit c:\apples\bananas\oranges

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-windows Operating system: Windows T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants