#root source file struct 'build' has no member named 'build'

1 messages · Page 1 of 1 (latest)

scenic veldt
#

Heya, trying to compile an efi binary with zig, however when i try to run zig build, i get this error:

/usr/lib/zig/std/Build.zig:2213:50: error: root source file struct 'build' has no member named 'build'
    switch (@typeInfo(@typeInfo(@TypeOf(build_zig.build)).@"fn".return_type.?)) {
                                        ~~~~~~~~~^~~~~~
build.zig:1:1: note: struct declared here
const std = @import("std");
^~~~~
referenced by:
    main: /usr/lib/zig/compiler/build_runner.zig:366:29
    callMain [inlined]: /usr/lib/zig/std/start.zig:627:37
    callMainWithArgs [inlined]: /usr/lib/zig/std/start.zig:587:20
    posixCallMainAndExit: /usr/lib/zig/std/start.zig:542:36
    2 reference(s) hidden; use '-freference-trace=6' to see all references

build.zig:

const std = @import("std");

fn main(b: *std.Build) void {
    const efistub_target = b.resolveTargetQuery(.{
        .os_tag = .uefi,
        .cpu_arch = .x86_64,
        .ofmt = .coff,
        .abi = .msvc,
    });

    const optimize_options = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "efistub",
        .root_module = b.createModule(.{
            .root_source_file = b.path("efistub/"),
            .target = efistub_target,
            .optimize = optimize_options,
        }),
    });
    b.installArtifact(exe);
}
fickle tide
#

your main function in build.zig should be named build and be public

scenic veldt
#

oh, i completely missed that part in the docs