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
cmd/link: Filepaths and importpaths are concatenated as-is, should FromSlash (can cause problems under Windows) #26917
Comments
How do I reproduce your problem here? Please, provide small program and instructions to reproduce. Thank you. Alex |
Oh, I'm sorry, I meant to link to https://github.com/Xjs/go-link-path-concat-bug. ( |
There might be other problems. But
GOROOT has to be absolute path, not relative. Also relative paths on Windows cannot be longer than 255 characters. I still do not understand what your problem is. What exactly are you trying to do? Alex |
Actually, I'm trying a Bazel build under Windows. Bazel's rules_go set the GOROOT to a relative path. (I'm discussing this with the rules_go maintainers as well.) However, I tried to recreate this bug as-is. It would be a lot of overhead to recreate a Bazel build that exhibits this behaviour, so I tried to isolate it as much as possible. If you like, I can provide a Bazel example as well, of course. My concrete bug report is that So I'm suggesting using the |
Thank you for explaining.
I am pretty sure, you cannot have GOROOT set to a relative path. But I will let others to confirm.
I do not believe any relative paths on Windows are allowed to be longer than 255 chars. So I don't see why expecting this to work. Alex |
Quoting from bazelbuild/rules_go#1664 (comment):
My original issue with this is now solved on the bazel-side. I still think the |
Change https://golang.org/cl/153237 mentions this issue: |
Using Bazel and rules_go, a combination of factors leads to
cmd/link
being executed with aGOROOT
relative to the build workspace folder, whose path can become very long. This resulted in obscure linker error messages such as:Windows appears to be confused by a path that is relative, longer than 255 characters, AND a combination of backslashes and slashes. (Some more info here.)
A fix that worked for me locally would be to use the
filepath
functions insrc/cmd/link/internal/ld/ld.go
, e. g. like Xjs@a9738aa .In experiments I have found that using an absolute
GOROOT
doesn't reproduce the error; I will suggest this workaround to the Bazel rules_go authors, too.What version of Go are you using (
go version
)?go version go1.10.3 windows/amd64
Does this issue reproduce with the latest release?
Last reproduced with a9dcbab .
The text was updated successfully, but these errors were encountered: