Skip to content
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

Importing a module with a ConfigHeader doesn't set a dependency to the ConfigHeader step #20320

Open
Lzard opened this issue Jun 16, 2024 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@Lzard
Copy link

Lzard commented Jun 16, 2024

Zig Version

0.14.0-dev.41+8f27a4370

Steps to Reproduce and Observed Behavior

In a project created with zig init, with the following build.zig:

const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});

    const config = b.addConfigHeader(.{}, .{});

    const module = b.addModule("module", .{
        .root_source_file = b.path("src/root.zig"),
    });
    module.addConfigHeader(config);

    const exe = b.addExecutable(.{
        .name = "issue",
        .root_source_file = b.path("src/main.zig"),
        .target = target,
    });
    exe.root_module.addImport("module", module);

    // Uncommenting the following line bypasses the issue
    // exe.step.dependOn(&config.step);

    b.installArtifact(exe);
}

Result:

thread 5968 panic: getPath() was called on a GeneratedFile that wasn't built yet. Is there a missing Step dependency on step 'configure blank header to config.h'?

Expected Behavior

Importing a Module with a ConfigHeader should set a dependency to that ConfigHeader's step.

Packages that use that Module are not able to set a dependency to the ConfigHeader step manually.

@Lzard Lzard added the bug Observed behavior contradicts documented or intended behavior label Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

1 participant