-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
> What steps will reproduce the problem? shell$ hg pull -u shell$ CC=gcc; export CC shell$ (cd src && bash all.bash;) > What is the expected output? Successful completion of build. > What do you see instead? Build terminates early with output: [...] --- cd ../misc/cgo/stdio rm -rf *.o *.a *.[568vq] [568vq].out hello fib chain run.out *.cgo1.go *.cgo2.c _cgo_defun.c _cgo_gotypes.go _cgo_export.* *.so _obj _test _testmain.go CGOPKGPATH= /home/pod/net/vcs/hg/g/go/go-latest/bin/cgo -- align.go file.go test.go exec 6c: no such file or directory make: *** [_cgo_defun.c] Error 2 > What is your $GOOS? $GOARCH? GOARCH=amd64 GOOS=linux > Which revision are you using? (hg identify) shell$ hg identify 12d3d5576b0d tip > Please provide any additional information below. Bisection indicates the problem was introduced by shell$ hg log -v -r 4a1fcee4b6e8 changeset: 5828:4a1fcee4b6e8 user: Ian Lance Taylor <iant@golang.org> date: Fri Jul 16 11:01:04 2010 -0700 files: src/cmd/cgo/gcc.go description: cgo: If CC is set in environment, use it rather than "gcc". R=rsc CC=golang-dev http://golang.org/cl/1842042 I can confirm that building *without* CC set in the environment is successful. The problem appears to be that when CC is set in the environment make (or at least GNU make) overrides the value of CC by virtue of src/Make.$(GOARCH) and then re-exports it when running rules. This value of CC (CC=6c for example) is not valid for cgo in this context. If CC is not set in the environment then (GNU) make appears not to export CC to its children at all. Changeset 4a1fcee4b6e8 therefore results in a change of behaviour since after this change cgo really cares about the value of CC from the environment. The following patch gets things working again but feels like little more than a bandaid. shell$ hg diff diff -r 4a1fcee4b6e8 misc/cgo/stdio/Makefile --- a/misc/cgo/stdio/Makefile Fri Jul 16 11:01:04 2010 -0700 +++ b/misc/cgo/stdio/Makefile Sat Aug 07 13:48:13 2010 +0100 @@ -3,6 +3,7 @@ # license that can be found in the LICENSE file. include ../../../src/Make.$(GOARCH) +unexport CC TARG=stdio CGOFILES=\ shell$ env | grep -e ^CC CC=gcc shell$ (cd src && bash all.bash;) [...] --- cd ../test 1 known bugs; 0 unexpected bugs shell$