Open rakino opened 4 hours ago
Could I get you to upload the two binaries for 0.13.0 somewhere so I can take a look at them?
@alexrp Sure, here's all mentioned binaries built on my machines: https://s3.boiledscript.com/misskey/5d740755-3d02-4898-8cd1-c651d634ed30
Would you mind trying a RelWithDebInfo
build as well, and diffing + uploading that?
Actually, scratch that, I found the issue:
cc @Vexu @ehaas
And to be clear on why that's a problem: @import("builtin").target
contains all the information about the target, which in this case is a native target, so that includes the kernel version, which is what we see in the diff.
I suppose it's debatable whether this is even a bug. It's a native build, so you should arguably expect native info in the std.Target
instance.
Maybe consider passing ZIG_TARGET_TRIPLE
to CMake. If you specify e.g. x86_64-linux-gnu
, Zig will use the minimum Linux kernel version supported by the Zig standard library (currently 4.19) rather than detecting the native kernel version. You can also specify the minimum as x86_64-linux.4.19-gnu
or similar.
Zig Version
Versions after Zig 0.9
Steps to Reproduce and Observed Behavior
While packaging newer Zig for Guix, I have observed reproducibility issue between two machines:
Machine A: AMD Ryzen 7 5800H, Guix System x86_64, linux 6.11.6 Machine B: Intel Xeon E3-1275 v5, Guix System x86_64, linux 6.6.59
Versions after Zig 0.9 are affected.
I can reproduce the issue with unmodified Zig source:
diffoscope output for 0.12.1, manually built on Guix System
```diff --- a-stage3/bin/zig +++ b-stage3/bin/zig ├── readelf --wide --decompress --hex-dump=.data.rel.ro {} │ @@ -17727,19 +17727,19 @@ │ 0x022687e0 d70f3002 00000000 07000000 00000000 ..0............. │ 0x022687f0 ea103002 00000000 25000000 00000000 ..0.....%....... │ 0x02268800 d70f3002 00000000 07000000 00000000 ..0............. │ 0x02268810 20342202 00000000 10000000 00880000 4"............. │ 0x02268820 00401060 80000000 80011800 10010000 .@.`............ │ 0x02268830 00000000 00000000 00000000 00000000 ................ │ 0x02268840 25000000 00000000 06000000 00000000 %............... │ - 0x02268850 0b000000 00000000 06000000 00000000 ................ │ + 0x02268850 06000000 00000000 3b000000 00000000 ........;....... │ 0x02268860 00000000 00000000 00000000 00000000 ................ │ 0x02268870 00000000 00000000 00000000 00000000 ................ │ - 0x02268880 06000000 00000000 0b000000 00000000 ................ │ - 0x02268890 06000000 00000000 00000000 00000000 ................ │ + 0x02268880 06000000 00000000 06000000 00000000 ................ │ + 0x02268890 3b000000 00000000 00000000 00000000 ;............... │ 0x022688a0 00000000 00000000 00000000 00000000 ................ │ 0x022688b0 00000000 00000000 02000000 00000000 ................ │ 0x022688c0 27000000 00000000 00000000 00000000 '............... │ 0x022688d0 00000000 00000000 00000000 00000000 ................ │ 0x022688e0 00000000 00000000 00000000 00000000 ................ │ 0x022688f0 08000000 00000000 01022f67 6e752f73 ........../gnu/s │ 0x02268900 746f7265 2f7a766c 70336e38 69776131 tore/zvlp3n8iwa1 ```@motiejus has also reproduced this in Debian environment:
0.13.0, Debian environment
```diff [motiejus@mtworx:~/code/zig/build]$ diff -u --color=always <(readelf --wide --decompress --hex-dump=.data.rel.ro stage3/bin/zig) <(readelf --wide --decompress --hex-dump=.data.rel.ro mtworx/zig) --- /dev/fd/63 2024-11-17 00:22:00.788856069 +0200 +++ /dev/fd/62 2024-11-17 00:22:00.789856069 +0200 @@ -18820,11 +18820,11 @@ 0x024bed50 00001004 18400000 00000cc0 00001100 .....@.......... 0x024bed60 00000000 00000000 00000000 00000000 ................ 0x024bed70 25000000 00000000 06000000 00000000 %............... - 0x024bed80 0a000000 00000000 0e000000 00000000 ................ + 0x024bed80 0b000000 00000000 03000000 00000000 ................ 0x024bed90 00000000 00000000 00000000 00000000 ................ 0x024beda0 00000000 00000000 00000000 00000000 ................ - 0x024bedb0 06000000 00000000 0a000000 00000000 ................ - 0x024bedc0 0e000000 00000000 00000000 00000000 ................ + 0x024bedb0 06000000 00000000 0b000000 00000000 ................ + 0x024bedc0 03000000 00000000 00000000 00000000 ................ 0x024bedd0 00000000 00000000 00000000 00000000 ................ 0x024bede0 00000000 00000000 02000000 00000000 ................ 0x024bedf0 1f000000 00000000 00000000 00000000 ................ ```Below are diffoscope outputs for builds produced in Guix's build environment, diff for 0.12.1 is same as my above one.
0.10.1
```diff --- /gnu/store/gqdi4drfn3js5cwgfmlpkyfm2xf3l5b0-zig-0.10.1/bin/zig +++ cuirass/gqdi4drfn3js5cwgfmlpkyfm2xf3l5b0-zig-0.10.1/bin/zig ├── readelf --wide --decompress --string-dump=.rodata {} │ @@ -77024,14 +77024,16 @@ │ [149be0] +�& │ [149bf9] )& │ [149c12] % │ [149c28] VO$ │ [149c40] D�( │ [149c59] >$ │ [149c70] 8�% │ + [149c94] ; │ + [149ca0] ; │ [149ca8] ' │ [149cb0] uespemos�odnarodarenegylsetybdet │ [149cf0] p�� │ [149d11] O' │ [149d21] 5& │ [149d31] f& │ [149d40] SJ' ```0.11.0
```diff --- /gnu/store/466cm9xpjqg80iqracj4qirsrdha1rnk-zig-0.11.0/bin/zig +++ cuirass/466cm9xpjqg80iqracj4qirsrdha1rnk-zig-0.11.0/bin/zig ├── readelf --wide --decompress --string-dump=.rodata {} │ @@ -64905,14 +64905,16 @@ │ [ 5ae48] xpnt4win2kvistawin10ws2003win8_1win10_th2win10_rs1win10_rs2win10_rs3win10_rs4win10_rs5win10_19h1 │ [ 5aef0] │ [ 5aef8] # │ [ 5af00] % │ [ 5af08] % │ [ 5af10] & │ [ 5af78] celfhexrawmachospirvdxcontainer │ + [ 5afc0] ; │ + [ 5aff8] ; │ [ 5b070] E │ [ 5b0b4] ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ │ [ 5b350] │ [ 5b380] @ │ [ 5b3e0] │ [ 5b420] ] │ [ 5b5e0] % ```0.12.1
```diff --- /gnu/store/70pnirlallhg02mr8x8s1bn33gwkgfzw-zig-0.12.1/bin/zig +++ cuirass/70pnirlallhg02mr8x8s1bn33gwkgfzw-zig-0.12.1/bin/zig ├── readelf --wide --decompress --hex-dump=.data.rel.ro {} │ @@ -17727,19 +17727,19 @@ │ 0x0228df80 ff713202 00000000 07000000 00000000 .q2............. │ 0x0228df90 12733202 00000000 25000000 00000000 .s2.....%....... │ 0x0228dfa0 ff713202 00000000 07000000 00000000 .q2............. │ 0x0228dfb0 c08b2402 00000000 10000000 00880000 ..$............. │ 0x0228dfc0 00401060 80000000 80011800 10010000 .@.`............ │ 0x0228dfd0 00000000 00000000 00000000 00000000 ................ │ 0x0228dfe0 25000000 00000000 06000000 00000000 %............... │ - 0x0228dff0 0b000000 00000000 06000000 00000000 ................ │ + 0x0228dff0 06000000 00000000 3b000000 00000000 ........;....... │ 0x0228e000 00000000 00000000 00000000 00000000 ................ │ 0x0228e010 00000000 00000000 00000000 00000000 ................ │ - 0x0228e020 06000000 00000000 0b000000 00000000 ................ │ - 0x0228e030 06000000 00000000 00000000 00000000 ................ │ + 0x0228e020 06000000 00000000 06000000 00000000 ................ │ + 0x0228e030 3b000000 00000000 00000000 00000000 ;............... │ 0x0228e040 00000000 00000000 00000000 00000000 ................ │ 0x0228e050 00000000 00000000 02000000 00000000 ................ │ 0x0228e060 27000000 00000000 00000000 00000000 '............... │ 0x0228e070 00000000 00000000 00000000 00000000 ................ │ 0x0228e080 00000000 00000000 00000000 00000000 ................ │ 0x0228e090 08000000 00000000 01022f67 6e752f73 ........../gnu/s │ 0x0228e0a0 746f7265 2f7a766c 70336e38 69776131 tore/zvlp3n8iwa1 ```0.13.0
```diff --- /gnu/store/slcqbxb47i7c4c2a53bzhdgf7chq4x86-zig-0.13.0/bin/zig +++ cuirass/slcqbxb47i7c4c2a53bzhdgf7chq4x86-zig-0.13.0/bin/zig ├── readelf --wide --decompress --hex-dump=.data.rel.ro {} │ @@ -18811,19 +18811,19 @@ │ 0x02345420 38d21f01 00000000 07000000 00000000 8............... │ 0x02345430 18e62001 00000000 25000000 00000000 .. .....%....... │ 0x02345440 38d21f01 00000000 07000000 00000000 8............... │ 0x02345450 a0bc2f02 00000000 10000000 00800800 ../............. │ 0x02345460 00001004 18400000 00000cc0 00001100 .....@.......... │ 0x02345470 00000000 00000000 00000000 00000000 ................ │ 0x02345480 25000000 00000000 06000000 00000000 %............... │ - 0x02345490 0b000000 00000000 06000000 00000000 ................ │ + 0x02345490 06000000 00000000 3b000000 00000000 ........;....... │ 0x023454a0 00000000 00000000 00000000 00000000 ................ │ 0x023454b0 00000000 00000000 00000000 00000000 ................ │ - 0x023454c0 06000000 00000000 0b000000 00000000 ................ │ - 0x023454d0 06000000 00000000 00000000 00000000 ................ │ + 0x023454c0 06000000 00000000 06000000 00000000 ................ │ + 0x023454d0 3b000000 00000000 00000000 00000000 ;............... │ 0x023454e0 00000000 00000000 00000000 00000000 ................ │ 0x023454f0 00000000 00000000 02000000 00000000 ................ │ 0x02345500 27000000 00000000 00000000 00000000 '............... │ 0x02345510 00000000 00000000 00000000 00000000 ................ │ 0x02345520 00000000 00000000 00000000 00000000 ................ │ 0x02345530 08000000 00000000 01022f67 6e752f73 ........../gnu/s │ 0x02345540 746f7265 2f7a766c 70336e38 69776131 tore/zvlp3n8iwa1 ```Expected Behavior
Builds being reproducible on different machines.