Skip to content

[Regression] Package fetching/lookup no longer idempotent #19557

@linusg

Description

@linusg

Zig Version

0.12.0-dev.3533+e5d900268

Steps to Reproduce and Observed Behavior

--- a/build.zig
+++ b/build.zig
@@ -2,7 +2,7 @@ const builtin = @import("builtin");
 const std = @import("std");
 
 const build_icu4zig = @import("icu4zig");
-const build_macos_sdk = @import("macos_sdk");
+// const build_macos_sdk = @import("macos_sdk");
 
 pub fn build(b: *std.Build) void {
     const target = b.standardTargetOptions(.{});
@@ -82,7 +82,7 @@ pub fn build(b: *std.Build) void {
         .cwd_relative = libgc.builder.getInstallPath(.header, ""),
     });
     if (target.result.os.tag == .macos) {
-        build_macos_sdk.addPaths(libgc.artifact("gc"));
+        // build_macos_sdk.addPaths(libgc.artifact("gc"));
     }
     kiesel.linkLibrary(libgc.artifact("gc"));
     kiesel.linkLibrary(libregexp.artifact("regexp"));
  • Run zig build -Denable-intl=false run three times in a row

First time:

/home/linus/Dev/kiesel/build.zig:4:31: error: no module named 'icu4zig' available within module root.@build
const build_icu4zig = @import("icu4zig");
                              ^~~~~~~~~
referenced by:
    build: /home/linus/Dev/kiesel/build.zig:105:9
    runBuild__anon_8851: /nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/Build.zig:2000:27
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Second time:

thread 113619 panic: unable to find module 'kiesel-runtime'
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/debug.zig:434:22: 0x11a91d6 in panicExtra__anon_15944 (build)
    std.builtin.panic(msg, trace, ret_addr);
                     ^
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/debug.zig:409:15: 0x1184ea9 in panic__anon_15324 (build)
    panicExtra(null, null, format, args);
              ^
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/Build.zig:1804:18: 0x114dd87 in module (build)
            panic("unable to find module '{s}'", .{name});
                 ^
/home/linus/Dev/kiesel/build.zig:110:30: 0x11019ae in build (build)
        kiesel_runtime.module("kiesel-runtime").addImport("kiesel", kiesel);
                             ^
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/Build.zig:2000:33: 0x10db773 in runBuild__anon_8851 (build)
        .Void => build_zig.build(b),
                                ^
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/compiler/build_runner.zig:310:29: 0x10d669e in main (build)
        try builder.runBuild(root);
                            ^
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/start.zig:511:37: 0x10bc645 in posixCallMainAndExit (build)
            const result = root.main() catch |err| {
                                    ^
/nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/lib/std/start.zig:253:5: 0x10bc161 in _start (build)
    asm volatile (switch (native_arch) {
    ^
???:?:?: 0x9 in ??? (???)
Unwind information for `???:0x9` was not available, trace may be incomplete

error: the following build command crashed:
/home/linus/Dev/kiesel/zig-cache/o/e2b29ca1864fa1641c29dedcaa40c811/build /nix/store/ys6lsgq43h868phxd0f13zjxavgc32ys-zig-0.12.0-dev.3533+e5d900268/bin/zig /home/linus/Dev/kiesel /home/linus/Dev/kiesel/zig-cache /home/linus/.cache/zig --seed 0x3fbef6c1 -Z45ea3ee8165a5f6d -Denable-intl=false run

Third time: it works?

steps [19/23] zig build-exe kiesel Debug native... LLVM Emit Object... Kiesel 0.1.0 [Zig 0.12.0-dev.3533+e5d900268] on linux
Use Ctrl+D to exit.
>

Expected Behavior

Running the same build more than once should always work or always fail.

There's a chance something is wrong with my build.zig{,.zon} (noticed this after hitting #19357), but I haven't seen something like this before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorregressionIt 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