-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: go tries to recompile already installed packages: missing headers #27027
Comments
This is likely because of You might have better luck using this package as a binary package. I assume the other option is to not change |
Compiling with |
GOPATH/pkg is not something you can micromanage anymore. It's just a set of 1-entry caches. If they're up-to-date for the requested build, they'll be used; otherwise not. The go command can now tell that relevant environment variables have changed since the package was built (in particular, $CGO_LDFLAGS changed), so it does not reuse the (stale) installed package. In general, a change to CGO_LDFLAGS should trigger a rebuild, so sorry but this is working as intended. I'm not sure what to say except that you now need to keep those environment variables set the same way from build to build. |
@rsc has a blog post somewhere (which I have failed to find) which introduces the notion of content-based staleness - the closest I could find was this golang-nuts post where he introduces it. But I recall an 'aha' moment when I read that. If I recall correctly, in the post I can't find, @rsc mentioned that initially he thought - and you might think - that 'depending on what happened to run before' was a feature which enabled you to do various things (as in this issue). He came around (and in his writing, I came around) to the idea that actually those problems can be solved through other means, giving us the very useful property that |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11rc1 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
I tried to build this program:
What did you expect to see?
I expected to get no errors. The package
github.com/pebbe/dbxml
is installed in GOPATH.What did you see instead?
Go tries to recompile the package that is already installed, but it fails because the header files are in a non-standard location. The package itself was installed with a modified environment, like this:
When I try to compile the example program, these environment variables are unavailable.
This all used to work fine in older versions of Go. I don't when this changed. Go 1.10? Go 1.11?
The text was updated successfully, but these errors were encountered: