From 693e40a495fa8af8d12a8e81a90041e66d42603c Mon Sep 17 00:00:00 2001 From: Martin HS Date: Tue, 20 Aug 2024 15:33:28 +0200 Subject: [PATCH] build: attempt at reproducible builds (#30321) This PR implements the conclusions from https://github.com/ethereum/go-ethereum/issues/28987#issuecomment-2296075028, that is: Building with `--strip-all` as a ld-flag to the cgo linker, to remove symbols. Without that, some spurious reference to a temporary file is included into the kzg-related library. Building with `--build-id=none`, to avoid putting a `build id` into the file. --- build/ci.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/ci.go b/build/ci.go index ac7060dc2f..fe507cf48f 100644 --- a/build/ci.go +++ b/build/ci.go @@ -249,7 +249,11 @@ func buildFlags(env build.Environment, staticLinking bool, buildTags []string) ( if runtime.GOOS == "linux" { // Enforce the stacksize to 8M, which is the case on most platforms apart from // alpine Linux. - extld := []string{"-Wl,-z,stack-size=0x800000"} + // See https://sourceware.org/binutils/docs-2.23.1/ld/Options.html#Options + // regarding the options --build-id=none and --strip-all. It is needed for + // reproducible builds; removing references to temporary files in C-land, and + // making build-id reproducably absent. + extld := []string{"-Wl,-z,stack-size=0x800000,--build-id=none,--strip-all"} if staticLinking { extld = append(extld, "-static") // Under static linking, use of certain glibc features must be