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

cmd/go: allow ccache to work by using relative paths when invoking the C compiler #12930

Closed
ghost opened this issue Oct 14, 2015 · 2 comments
Closed
Milestone

Comments

@ghost
Copy link

ghost commented Oct 14, 2015

Executing "CC=ccache-gcc go build" multiple times in misc/cgo/life always causes ccache to miss. This is because the build is passing absolute paths to the C compiler.

Current output of "CC=ccache-gcc go build -x":
ccache-gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -I $WORK/_/home/.../misc/cgo/life/_obj/ -g -O2 -o $WORK/_/home/.../misc/cgo/life/_obj/_cgo_main.o -c $WORK/_/home/.../misc/cgo/life/_obj/_cgo_main.c

Expected output of "CC=ccache-gcc go build -x":
ccache-gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -I . -g -O2 -o _cgo_main.o -c _cgo_main.c

@ghost ghost added this to the Go1.6 milestone Oct 14, 2015
@rsc
Copy link
Contributor

rsc commented Nov 5, 2015

Those absolute paths are in temporary directories, the names of which change from run to run. We run the actual build in the package directory. I mean, I guess we could say ../../../../../../../$WORK/_/home/.../misc/cgo/life/_obj/cgo_main.c instead of $WORK//home/.../misc/cgo/life/_obj/_cgo_main.c, but does that really make sense?

If ccache works with the ../../../../ but not without, that seems like a bug in ccache.

@rsc
Copy link
Contributor

rsc commented Nov 23, 2015

Still confused about how this could possibly work, since $WORK is different every time the go command runs. I think this is probably not the go command's fault. Given the lack of reply, closing.

@rsc rsc closed this as completed Nov 23, 2015
@golang golang locked and limited conversation to collaborators Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants