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

x/mobile: gomobile bind does not create reproducible builds, ignores -trimpath #40254

Open
eighthave opened this issue Jul 16, 2020 · 1 comment
Open

Comments

@eighthave
Copy link

@eighthave eighthave commented Jul 16, 2020

A full setup/build log is here:
https://gitlab.torproject.org/eighthave/snowflake/-/jobs/634

What version of Go are you using (go version)?

$ go version
 go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/builds/eighthave/snowflake/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build833562092=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Ran a build with gomobile bind -v -target=android -trimpath -ldflags=-buildid= . in both gitlab-ci and a local vagrant/libvirt VM.

What did you expect to see?

Reproducible builds between the two.

What did you see instead?

Diffs between the two builds in 3 of the 4 architectures, including diffs caused by build paths, which -trimpath is specifically meant to disable. Full diff is here:

diffoscope-output.html.zip

@gopherbot gopherbot added the mobile label Jul 16, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jul 16, 2020
@eighthave
Copy link
Author

@eighthave eighthave commented Jul 20, 2020

Before I ran the build using the go 1.14 Debian package. I tried again with the binary release of go 1.14.6, and got somewhat improved results, but not a complete fix as compared to go build -trimpath. When running gomobile bind -v -target=android -trimpath ., there were still build-path-related diffs in the binary. But running gomobile bind -v -target=android -trimpath -ldflags=-buildid= . seemed to have successfully removed the build-path-related blob. The attached diffoscope output compares those two, all else being equal.

trimpath-go-1.14.6.html.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.