-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: working directory affects binaries even with -trimpath #33772
Comments
Here's a shorter repro without needing to build
Running that above on different machines produces different binaries, even if both machines are the same host OS. |
It seems that the current working directory has some affect on the build ID embedded in the binary:
|
CC @jayconrod |
This difference is due to the .note.go.buildid section added by the linker. It can be set to something static e.g. Thanks to @neutralinsomniac for working with me to find this. |
Manually specifying the "-buildid" removes the last source of variability when the release binaries is built on one system or another. See golang/go#33772 (comment) Change-Id: Ibc9b8e99b5b76719735942a510570bcbf96dfea6 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/193498 Reviewed-by: Damien Neil <[email protected]>
I just hit the same issue -- is there somewhere this can be documented better, and/or maybe given a -reproducible flag that == "-trimpath -ldflags=-buildid="? |
Change https://golang.org/cl/195318 mentions this issue: |
I'd like this to be considered for backport to Go 1.13 (@gopherbot, please do the honors). There is no real workaround to get the functionality of |
Backport issue(s) opened: #34326 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/198259 mentions this issue: |
…y when -trimpath is set The '-trimpath' flag tells 'go build' to trim any paths from the output files that are tied to the current workspace or toolchain. When this flag is set, we do not need to include the package directory in the text hashed to construct the action ID for each package. Updates #33772 Fixes #34326 Change-Id: I20b902d2f58019709b15864ca79aa0d9255ae707 Reviewed-on: https://go-review.googlesource.com/c/go/+/195318 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> (cherry picked from commit aa680c0) Reviewed-on: https://go-review.googlesource.com/c/go/+/198259 Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
The fix for golang/go#33772 has been backported to Go 1.13 (golang/go#34326) and is included in the Go 1.13.4 release.
The fix for golang/go#33772 has been backported to Go 1.13 (golang/go#34326) and is included in the Go 1.13.4 release.
Using
go1.13rc1
After #16860 was closed, I was hoping that I could build byte-for-byte identical builds regardless of what machine was used to build the binaries. At the present moment, building binaries are nearly identical regardless of the machine used, except for the following bytes:
There seems to be some type of build ID encoded into the binary.
Steps to reproduce:
Unfortunately, that command will take a while to run since it needs to build the C++
protoc
binary as a dependency.This need not block
go1.13
release.The text was updated successfully, but these errors were encountered: