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

cmd/go: install "-a -buildmode=shared std" not reproducible #69464

Open
And-ZJ opened this issue Sep 14, 2024 · 3 comments · May be fixed by #69394
Open

cmd/go: install "-a -buildmode=shared std" not reproducible #69464

And-ZJ opened this issue Sep 14, 2024 · 3 comments · May be fixed by #69394
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@And-ZJ
Copy link
Contributor

And-ZJ commented Sep 14, 2024

Go version

go version devel go1.24-ad6ee21bbf Wed Sep 11 06:30:02 2024 +0000 linux/arm64

Output of go env in your module/workspace:

GO111MODULE='auto'
GOARCH='arm64'
GOBIN=''
GOCACHE='/usr1/GOCACHE'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr1/GOPATH/pkg/mod'
GOOS='linux'
GOPATH='/usr1/GOPATH'
GOROOT='/usr1/go'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr1/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='devel go1.24-ad6ee21bbf Wed Sep 11 06:30:02 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD=''
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2853643470=/tmp/go-build -gno-record-gcc-switches'

What did you do?

$ cd go/

$ go install -a -buildmode=shared std
$ md5sum pkg/linux_arm64_dynlink/libstd.so 
eca98dcf122cb4d23ca1483297b283e0  pkg/linux_arm64_dynlink/libstd.so
$ strings pkg/linux_arm64_dynlink/libstd.so | grep "/tmp"
/tmp/go-build393272947/b301/libstd.so

$ go install -a -buildmode=shared std
$ md5sum pkg/linux_arm64_dynlink/libstd.so 
829d40dfe52515b820f0c9e59529583d  pkg/linux_arm64_dynlink/libstd.so
$ strings pkg/linux_arm64_dynlink/libstd.so | grep "/tmp"
/tmp/go-build649248685/b301/libstd.so

What did you see happen?

The libstd.so file is not reproducible. This problem also exists in earlier versions.

What did you expect to see?

I think the libstd.so file should be reproducible.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/612396 mentions this issue: cmd/go: make sure the linker for shared doesn't include tempdir path

@cagedmantis cagedmantis changed the title cmd/go: "go install -a -buildmode=shared std" not reproducible cmd/go: install "-a -buildmode=shared std" not reproducible Sep 16, 2024
@cagedmantis cagedmantis added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Sep 16, 2024
@cagedmantis cagedmantis added this to the Backlog milestone Sep 16, 2024
@cagedmantis
Copy link
Contributor

cc @matloob @samthanawalla

And-ZJ added a commit to And-ZJ/go that referenced this issue Sep 19, 2024
This is similar to CL 478196 and CL 477296,
but this is for -buildmode=shared.

When using "go install -buildmode=shared std",
because the gold linker is used by default on Linux arm64,
it will cause temporary paths to be included in libstd.so.

Based on the changes of CL 478196,
I speculate that this may also have issues on other platforms.
So, this change is for all platform.

But I don't have any other platforms and
don't know what the file name for verification,
so the testcase are only for the Linux platform.
I hope someone can improve this testcase. Thanks!

Fixes golang#69464
And-ZJ added a commit to And-ZJ/go that referenced this issue Sep 19, 2024
This is similar to CL 478196 and CL 477296,
but this is for -buildmode=shared.

When using "go install -buildmode=shared std",
because the gold linker is used by default on Linux arm64,
it will cause temporary paths to be included in libstd.so.

Based on the changes of CL 478196,
I speculate that this may also have issues on other platforms.
So, this change is for all platform.

But I don't have any other platforms and
don't know what the file name for verification,
so the testcase are only for the Linux platform.
I hope someone can improve this testcase. Thanks!

Fixes golang#69464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants