Skip to content

non-deterministic zls_gen #2138

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

Closed
bmwiedemann opened this issue Jan 9, 2025 · 2 comments
Closed

non-deterministic zls_gen #2138

bmwiedemann opened this issue Jan 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@bmwiedemann
Copy link

bmwiedemann commented Jan 9, 2025

Zig Version

0.13.0

ZLS Version

0.13.0

Client / Code Editor / Extensions

No response

Steps to Reproduce and Observed Behavior

build zls twice (from scratch) with debuginfo enabled

Builds embed a random path from

- /home/abuild/rpmbuild/BUILD/zls-0.13.0/zig-cache/o/1c703156d1c748dd822850009e362839/zls_gen --generate-version-data 0.13.0 --langref_path /usr/share/doc/packages/zig/langref.html --generate-version-data-path /home/abuild/rpmbuild/BUILD/zls-0.13.0/zig-cache/o/e9fa9483a7e7709690e1a2c451e3f26d/version_data_0.13.0.zig
+ /home/abuild/rpmbuild/BUILD/zls-0.13.0/zig-cache/o/a584116cfed34531fa759dd6d5a6e146/zls_gen --generate-version-data 0.13.0 --langref_path /usr/share/doc/packages/zig/langref.html --generate-version-data-path /home/abuild/rpmbuild/BUILD/zls-0.13.0/zig-cache/o/3467172f659a38bcf17b0fa61da120b0/version_data_0.13.0.zig

into debuginfo, which makes the main binary vary as well in the debug-link info.

Expected Behavior

Builds should produce two bit-identical binaries

Relevant log output

No response

@bmwiedemann bmwiedemann added the bug Something isn't working label Jan 9, 2025
@Techatrix
Copy link
Member

This has already been fixed by #2000. Also note that Zig does not guarantee reproducible debug builds.

@bmwiedemann
Copy link
Author

Via ziglang/zig#22663 I found that this is probably not fixed by #2000 but this patch helped:

--- a/build.zig
+++ b/build.zig
@@ -88,7 +88,9 @@ pub fn build(b: *Build) !void {
     const gen_exe = b.addExecutable(.{
         .name = "zls_gen",
         .root_source_file = b.path("src/config_gen/config_gen.zig"),
-        .target = b.host,
+        .target = b.resolveTargetQuery(.{
+            .cpu_model = .baseline,
+        }),
         .single_threaded = true,
     });

zig might get a toolchain patch to make results reproducible without.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants