Skip to content

build: unexpected panic "unable to find module" #19561

@kubkon

Description

@kubkon

Zig Version

0.12.0-dev.3539+23f729aec

Steps to Reproduce and Observed Behavior

$ git clone https://github.com/kubkon/zld
$ rm -rf ~/.cache/zig
$ zig build install
thread 1024474 panic: unable to find module 'yaml'
/opt/lib/zig/std/debug.zig:434:22: 0x1009d8ab3 in panicExtra__anon_15675 (build)
    std.builtin.panic(msg, trace, ret_addr);
                     ^
/opt/lib/zig/std/debug.zig:409:15: 0x10098ea93 in panic__anon_14735 (build)
    panicExtra(null, null, format, args);
              ^
/opt/lib/zig/std/Build.zig:1804:18: 0x10095b937 in module (build)
            panic("unable to find module '{s}'", .{name});
                 ^
/Users/kubkon/dev/zld/build.zig:40:50: 0x10091a0f3 in build (build)
    exe.root_module.addImport("yaml", yaml.module("yaml"));
                                                 ^
/opt/lib/zig/std/Build.zig:2000:33: 0x1008f1957 in runBuild__anon_8389 (build)
        .Void => build_zig.build(b),
                                ^
/opt/lib/zig/compiler/build_runner.zig:310:29: 0x1008ec4ab in main (build)
        try builder.runBuild(root);
                            ^
/opt/lib/zig/std/start.zig:511:37: 0x1008f431b in main (build)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x1890ee0df in ??? (???)
???:?:?: 0xb2467fffffffffff in ??? (???)
error: the following build command crashed:
/Users/kubkon/dev/zld/zig-cache/o/9dcc18ccc579b2876db6f08ebdec300b/build /opt/bin/zig /Users/kubkon/dev/zld /Users/kubkon/dev/zld/zig-cache /Users/kubkon/.cache/zig --seed 0xb585ccf2 -Z02d3ef5318c7eb5e install

Running the very same command afterwards again works as expected:

$ zig build install

Expected Behavior

No panic when trying to build the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorzig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions