-
Notifications
You must be signed in to change notification settings - Fork 441
Write a script for bit-perfect deterministic build #2410
Comments
i agree we need reproducible builds. Here is one perhaps simple solution something like "brew doctor" on os/x. so instead of a single script that "does everything" I suggest a single "doctor" script that "checks everything we need to" in order to be sure e.g. the go version is correct, dependencies are correct, etc. it can print the first error and exit if not. and we can offer a variety of solutions for each part to devs such as: have documentation or link to go install page; bash script to download go; or python support scripts that can be used optionally to install certain parts such as go but are not required. the 'siadoctor' script would let people know their environment was considered to meet all known preconditions required for a reproducible build and would let us separate the detection of environment anomalies from the remedy. |
@petabytestorage I made a draft of such a script depending only on bash coreutils wget tar sed gcc make (this will allow to reproduce it on wide range of machines). Currently it is working but producing different binaries on some host-target combinations. |
One more step towards byte-perfect reproducibility. The option -a tells Go to rebuild everything. Libraries in $GOROOT/pkg/$GOOS_GOARCH could be (and are likely to) build with other toolchain, leaking build directory of that other toolchain into resulting binaries. See NebulousLabs#2410
@starius i would not want to "make" people do anything extra manually of course. my point was rather if i were given the choice of only one of two options: a) a "doctor" script or b) a "download everything and build" script, i would choose a). because a) is more usable in a wider variety of circumstances and contains checks that can make a higher quality script of type b). that is, a script of type b) can proceed "blindly" (which is sometimes destructive and not really very flexible with other build choices) or it can run the same checks that a type a) "doctor" script would and in so doing can offer the user a more intelligent and friendly menu: 1. install automatically 2. install manually yourself. so the best case to me is two separate scripts. one doctor and another auto installer that happen to both use the same acceptance checks for each environmental dependency. it can be one script in two modes. the thing i want to avoid is an "install everything" script that is hard to maintain because it doesn't try to find out what is wrong since it always installs everything. |
The idea of the script is to have minimal environmental dependencies (bash coreutils wget tar sed gcc make) and still build everything from source. It allows everybody who has these tools installed to run the script and compare the resulting binaries with the released ones. If anything goes wrong (e.g. checksum of a downloaded file mismatches), it stops (thanks to There's no advantage of using prebuilt Go binaries or user-provided Sia sources. Can we update the script draft to be more doctor-like e.g. printing user friendly messages in case of download error? |
the script is long and i thought it was doing much more. it was the many lines of special cases that confused me in there for patches. now that you describe the minimum set of tools it requires (all ancient) and mentioned the strict shell option setting i think it is great already and good enough to be helpful. i don't see any need for a separate |
My script works, but produces different binaries on different host platforms :-) Possible workaround: Sia can be switched to x/crypto/ssh/terminal #2414 |
add "Feature Request" Label |
Now after speakeasy was replaced with x/crypto/ssh/terminal it looks like the binaries are the same on Linux 386, Linux amd64. The checksums:
Those who have ARM could verify that you have the same binaries. |
I ran your script on my RaspberryPi 3. Many but not all have the same hash. What's the next step?
|
All files that are different belong to *_386 platforms. |
Following on from #2388 (comment) I think we should provide a shell script producing the released binary from scratch: downloads and installs Go, downloads Sia and all its dependencies and buildes them. Then everybody can run the script and compare results bit-by-bit.
The script can use the following commands: standard (
cd grep cp ...
) and build (make gcc wget git sha256sum
).I wrote a script to download and build Go of a particular version: https://github.com/starius/gohere
It is in Python and I am not sure if we want to have Python as a dependency. On the other hand Python is less fragile than shell (that is why I used it in my script).
The text was updated successfully, but these errors were encountered: