-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: reproducible builds don't work on macOS #40979
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
Comments
It looks like temporary file names are built into the binary. I'll take a look. |
Yeah, it seems the case for any cgo program on darwin, since at least Go 1.11 (Go 1.10 doesn't work on my machine). |
I think it is the darwin linker adds them. I don't know how to make it not to... |
Possibly DWARF related? What happens when "-w" is added to linker options? |
-w doesn't help. If I understand the otool dump correctly, the file paths are in __LINKEDIT segment. |
Are the paths coming from the command line? Would it help to chdir to the directory, and just pass plain .o files to the linker? |
Good point. The command line does include the paths. But if I |
If you chdir, does it record the paths for each object, or is it recording the current directory somewhere? |
The paths for each object. |
Well that's quite annoying. |
Change https://golang.org/cl/250944 mentions this issue: |
Change https://golang.org/cl/253157 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I've created a repository with a small app where I can reproduce this issue easily. It uses one module with native files (
go-duktape
): https://github.com/mandrigin/golang-reproducible-builds-issue-osx/The app builds the same source twice into 2 different files
go build -asmflags -trimpath -ldflags=-buildid= -o t1 .
go build -asmflags -trimpath -ldflags=-buildid= -o t2 .
Then it takes sha sums of both files and prints them. Also it prints a diff between these files.
What did you expect to see?
Reproducible builds on both Alpine (in Docker) and macOS.
What did you see instead?
Reproducible builds on Alpine work. (hashes match, no diff between binary files).
Reproducible builds on macOS are broken.
Diff on macOS contains entries like this one
Clang Version
The text was updated successfully, but these errors were encountered: