Skip to content

Builds are no longer reproducible #13919

@leighmcculloch

Description

@leighmcculloch

Zig Version

0.10.0

Steps to Reproduce and Observed Behavior

const std = @import("std");

pub fn main() void {
    std.debug.print("{any}", .{1});
}

Building that code file multiple times with release results in different binaries every time:

rm main ; zig build-exe -O ReleaseSafe main.zig && mv main main1 && shasum -a 256 main1
89d9955ed3278f2e3094d895bf6edc35ea99fdcf9a451a79566fdb9d9c38ef6b  main1rm main ; zig build-exe -O ReleaseSafe main.zig && mv main main2 && shasum -a 256 main2
0ce290b125384145b8ef40471c74a6e2befe2bb29bc1a26db93fb55ca6dd4a91  main2

Upon a diff inspection, the difference is minimal and consistently In these same locations:

git diff --no-index =(hexdump -C main1) =(hexdump -C main2)
diff --git a/tmp/zshvBoeFg b/tmp/zshy7Dwt7
index 9f7964d..8ba3816 100644
--- a/tmp/zshvBoeFg
+++ b/tmp/zshy7Dwt7
@@ -101,7 +101,7 @@
 00000640  00 00 00 00 00 00 00 00  32 00 00 00 20 00 00 00  |........2... ...|
 00000650  01 00 00 00 00 00 0d 00  00 00 0d 00 01 00 00 00  |................|
 00000660  03 00 00 00 00 00 00 00  1b 00 00 00 18 00 00 00  |................|
-00000670  ef ee 6b d6 b6 c7 2c 65  41 c1 12 47 6d f0 c9 ff  |..k...,eA..Gm...|
+00000670  b2 56 49 d3 1d c2 36 c5  1a dc d6 a6 1a 91 41 12  |.VI...6.......A.|
 00000680  0c 00 00 00 38 00 00 00  18 00 00 00 02 00 00 00  |....8...........|
 00000690  00 00 27 05 00 00 01 00  2f 75 73 72 2f 6c 69 62  |..'...../usr/lib|
 000006a0  2f 6c 69 62 53 79 73 74  65 6d 2e 42 2e 64 79 6c  |/libSystem.B.dyl|
@@ -9556,7 +9556,7 @@
 00027d60  0d 19 00 00 0e 0c 00 00  0c 61 02 00 01 00 00 00  |.........a......|
 00027d70  1e 19 00 00 64 00 00 00  00 00 00 00 00 00 00 00  |....d...........|
 00027d80  20 19 00 00 64 00 00 00  00 00 00 00 00 00 00 00  | ...d...........|
-00027d90  25 19 00 00 66 00 01 00  50 20 98 63 00 00 00 00  |%...f...P .c....|
+00027d90  25 19 00 00 66 00 01 00  5e 20 98 63 00 00 00 00  |%...f...^ .c....|
 00027da0  00 00 00 00 2e 01 00 00  c0 06 00 00 01 00 00 00  |................|
 00027db0  26 00 00 00 24 01 00 00  c0 06 00 00 01 00 00 00  |&...$...........|
 00027dc0  00 00 00 00 24 00 00 00  30 00 00 00 00 00 00 00  |....$...0.......|

This build is on macOS arm64.

Expected Behavior

According to https://ziglang.org/documentation/master/#Build-Mode the ReleaseSafe and other release builds are Reproducible builds.

Metadata

Metadata

Assignees

Labels

bugObserved behavior contradicts documented or intended behavioros-macosregressionIt worked in a previous version of Zig, but stopped working.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions