Skip to content

Commit

Permalink
build: make go buildid static (ethereum#30342)
Browse files Browse the repository at this point in the history
The previous clearing of buildid did fully work, turns out we need to
set it in `ldflags`

The go buildid is the only remaining hurdle for reproducible builds, see
ethereum#28987 (comment)

This PR changes the go build id application note to say literally `none`

golang/go#33772 (comment):

> This difference is due to the .note.go.buildid section added by the
linker. It can be set to something static e.g. -ldflags=-buildid= (empty
string) to gain reproducibility.
  • Loading branch information
holiman authored Aug 23, 2024
1 parent 941ae33 commit ada20c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ func doInstall(cmdline []string) {
// buildFlags returns the go tool flags for building.
func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (flags []string) {
var ld []string
// See https://github.com/golang/go/issues/33772#issuecomment-528176001
// We need to set --buildid to the linker here, and also pass --build-id to the
// cgo-linker further down.
ld = append(ld, "--buildid=none")
if env.Commit != "" {
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitCommit="+env.Commit)
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitDate="+env.Date)
Expand Down

0 comments on commit ada20c0

Please sign in to comment.