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
gccgo, cmd/go: GOTOOLDIR not being used #10264
Comments
Here is a patch to fix this. It seems that build.ToolDir was not being pulled in for some reason.
|
part of #10092 |
gccgo cmd/go: GOTOOLDIR not being used golang#10264
gccgo cmd/go: GOTOOLDIR not being used golang#10264
gccgo cmd/go: GOTOOLDIR not being used golang#10264 update
The proposed change seems clearly wrong for gccgo in general. If I apply that patch, the gccgo version of the go tool will no longer be able to invoke the cgo tool. |
Ok, I do not understand why the build.ToolDir is not getting set from that expression and where it is coming from instead, how it is getting the /usr/local value. This is just the workaround that I put in place to continue working on it. Have not tried with cgo. |
For gccgo, build.Tooldir is set based on a value computed in libgo/Makefile.am. See the s-version target in that file for the original source. The important point is that the gccgo-built version of the go tool must be able to locate the gccgo-built version of the cgo tool. |
OK, that explains the behavior. But If we are to recompile that in a bootstrap we will want to be able to override it in the env. |
why do we need to override the tooldir when recompile it (what?) in a
bootstrap?
gc bootstrap shouldn't involve gccgo's tooldir at all.
|
I am working on compiling the entire go core with gccgo and not with gc itself. This is an experiment to make gccgo a better implementation of go. |
The use case for this patch is for example where to find the cgo command, I want to compile the cgo from the go source not use one compiled by gccgo for example. Basically I would like this to be flexible and not hard coded to one path. |
is runtime package part of the ”go core"? How do you plan to deal with the
assembly files in runtime?
There are other ways to make gccgo a better implementation of go than being
able to compile the "go core". For example, escape analysis (cmang is
working
on that) or whole program analysis to devirtualize interface calls.
the cgo in gc repository doesn't support many of the architectures that
gccgo
support, and I'm not convinced you should compile cgo from the gc and put
it into gccgo's tooldir.
|
Hi there, these are good points, will have to think about that. Right now this is my GO learning project and I intend to continue working on it as i have time. I have been working on patches to the build.go to emit Makefiles and I hope to find other interesting usages of the core code. If I find a roadblock that requires gc of course I can use it for that specific case or rewrite the code. Once I have had my learning time I will be able to make better contributions. I would really like to learn more about how to improve the gcc, and I hope I will be able to do that. |
I feel like I'm not grasping the point of this. I originally thought that you wanted to be able to use gccgo as a bootstrap compiler to start a gc build. That sounds useful. But now it sounds like you want to compile the gc cmd/go code with the gccgo go/build package. That isn't going to work, and making that work doesn't seem like a useful exercise. If that is a necessary step for using gccgo as the bootstrap compiler for a gc build, then can you walk through the high-level steps that get us to that point? Thanks. |
if you have gccgo installed into a system dir and want to have it call out to user tools you will need this feature. Lets say a user has a custom goc binary that they compiled using whatever means, we should support overriding the hardcoded location of the binaries, just for the flexibility of the user. |
Makes sense, I suppose. We would have to figure out a good approach. Setting GOTOOLDIR in the environment does not affect the standard go tool at all. Setting GOROOT, GOARCH, and GOOS does affect it. For GCC, on the other hand, setting GCC_EXEC_PREFIX affects where it finds the tools. I don't know what is best. |
What about version skew problems? The go tool in the gc
repository supports overriding GOROOT, and due to
miscommunication with the users, we received bug reports
originating from the fact that the user installed a new version
of Go but forgot to change GOROOT, so the new go command
is still using the old tools (cgo, 6g, 6l, etc.)
cmd/go doesn't respect $GOTOOLDIR now, I see no reason
to add a new environment variable and repeat the same mistake
again.
If the user compiles a custom gccgo, a corresponding cmd/go
should also be built.
|
Hello, |
I agree that we should first focus on the steps needed to compile the go compiler and then bootstrap via that gc. Afterwards I can look into compiling other code to look for compiler bugs. |
GOTOOLDIR is printed by go env for use by things that want to get to the tool dir. It is explicitly NOT something that is pulled from the environment. This is working as intended. |
(Note that similarly even though go env prints GOCHAR= you cannot override GOCHAR.) |
using the go build with gccgo tries to use the tooldir compiled into the gcc but not the one specified in the environment.
It is looking in /usr/local/libexec/gcc/powerpc64le-unknown-linux-gnu/5.0.0
but should use GOTOOLDIR
The compiler was not configured right when built, but we should be able to override this.
The text was updated successfully, but these errors were encountered: