-
Notifications
You must be signed in to change notification settings - Fork 18k
build: setting CC to "ccache clang" does not work #11685
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
Comments
This affects building any package with cgo and isn't specific to building Go itself. It's a regression that was introduced in commit b38fa89 |
The build doesn't discard the options after the space character--you can see them in your gist in GOGCCFLAGS. But you are correct that the build assumes that the first word in $CC is special, and that it doesn't need to keep the second work immediately after the first word as is true for something like "ccache clang". I doubt this will be fixed for the 1.5 release. For now you will have to work around the problem, either by using a shell script or by omitting "ccache". Frankly, "ccache" isn't buying you anything here, so I recommend omitting it until this is fixed. |
For what it is worth, this was already semi-broken in Go 1.4, where it executes the following commands for
Where the last command isn't correct. So this is only partly a regression towards 1.4. It used to work, however, in 2012, where 7ae6872 specifically added support for it. |
In my opinion, this isn't a golang bug. cgo should just print a warning when CC contains spaces, so that the user can fix the actual cause of the problem. Solution: $ cat ~/bin/ccache-gcc $ cat ~/bin/ccache-g++ $ cat ~/.bashrc (relevant lines only) |
@atom-symbol I don't think I agree. I think you should be able to use spaces in $CC, and my understanding is that it used to work. It's not a major issue--as you say, you can always use a shell script--but I think we should fix it so that it works. |
@ianlancetaylor CC="xxx yyy zzz" is ambiguous because it is uncertain whether the executable is "xxx" or "xxx yyy zzz". One way to decide is first to look whether there exists "xxx yyy zzz" executable, if it doesn't than for check existence of "xxx yyy", etc. In the absolute, fixing this issue is impossible because solving it would require go build to know the mind's meaning of spaces in "xxx yyy zzz". Even if the build checks for the existence of "$PATH/xxx yyy zzz", it doesn't guarantee that the person really meant "$PATH/xxx yyy zzz" because the existence of "$PATH/xxx yyy zzz" may just be a coincidence that the person did not took into account. |
@atom-symbol CC="xxx yyy zzz" doesn't seem |
@atom-symbol I agree with @tucnak. It's not ambiguous. Spaces separate arguments. That is historically how the CC environment variable works on Unix systems. Programs like make and autoconf support CC with spaces, and people expect to be able to use them. |
There's a handful of problems. First, in cmd/go when it sees a multifield CC value like "ccache clang", it resets CC="ccache" and moves "clang" into GOGCCFLAGS. (It also assumes it's able to insert arguments after the first field like "ccache -I objdir clang".) Second, cmd/cgo doesn't use GOGCCFLAGS, so it doesn't see the "clang" argument. Third, when you run "go env", it runs mkEnv again based on the updated environment, so the "clang" string disappears completely from the output of Lastly, cmd/dist/test.go is currently written to assume |
This has never worked, and ccache isn't particularly useful for Go, so it doesn't seem like a blocker for Go 1.6. I'll look into it for Go 1.7. |
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation, when the host and target architectures are the same build a set of host binaries and tools with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation, when the host and target architectures are the same build a set of host binaries and tools with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation, when the host and target architectures are the same build a set of host binaries and tools with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation, when the host and target architectures are the same build a set of host binaries and tools with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation, when the host and target architectures are the same build a set of host binaries and tools with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation, when the host and target architectures are the same build a set of host binaries and tools with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation build and install a set of compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation build and install a set of compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation build and install a set of compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation build and install a set of compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation build and install a set of compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The go build system doesn't have the notion of cross compiling, but just the notion of architecture. When the host and target architectures are different it expects to be given a target cross compiler in CC_FOR_TARGET. When the architectures are the same it will use CC_FOR_TARGET for both host and target compilation. To work around this limitation build and install a set of compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. Also, the go build system is not compatible with ccache, so use HOSTCC_NOCCACHE. See golang/go#11685. Fixes build errors like these: host/usr/bin/go: No such file or directory http://autobuild.buildroot.net/results/6664189a6f3a815978e8d0a1d7ef408ca47e2874/ Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Use the host compiler when building host tools. The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE here. See golang/go#11685. Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
I am not able to build Go from Git (tag: go1.5beta1) with bootstrapping go1.4.2 on OSX 10.10.4, cos of wrong handling of $CC environmental variable.
Steps to reproduce:
export CC="ccache clang"
./all.bash
Expected result: built Go with exit status 1
Observed result: https://gist.github.com/tucnak/77c6d21d299f3c73ee7e
Looks like build script cuts off everything after space char in $CC, so instead of calling
ccache clang -E -dM ...
it doesccache -E -dM ...
which is wrong. There must be a regression!The text was updated successfully, but these errors were encountered: