standardReleaseOptions() gone?

Hi.

I can not build a project with fresh zig release:

@mono:~/2-coding/zig-lang/edsm-in-zig-demo-3$ /opt/zig-0.11/zig build
/home/zed/2-coding/zig-lang/edsm-in-zig-demo-3/build.zig:7:19: error: no field or member function named 'standardReleaseOptions' in 'Build'
    const mode = b.standardReleaseOptions();
                 ~^~~~~~~~~~~~~~~~~~~~~~~
/opt/zig-0.11/lib/std/Build.zig:1:1: note: struct declared here
const std = @import("std.zig");
^~~~~
referenced by:
    runBuild__anon_7124: /opt/zig-0.11/lib/std/Build.zig:1638:27

And there is nothing about standardReleaseOptions() in ‘0.11.0 Release Notes’ :frowning:
What should I do to fix this?

There have been a lot of changes to the build system and build.zig.
I would recommend you to run zig init-exe in a new folder.
That will give you a good example of a 0.11.0 build.zig file.

3 Likes

Ok, minimal build.zig that works for me seems to be

const std = @import("std");

pub fn build(b: *std.build.Builder) void {

    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "dirmon",
        .root_source_file = .{ .path = "src/main.zig" },
        .target = target,
        .optimize = optimize,
    });

    b.installArtifact(exe);
}

Then one little question - where and how do I set exe.single_threaded = true;?

ah, it’s ok

    const exe = b.addExecutable(.{
        .name = "dirmon",
        .root_source_file = .{ .path = "src/main.zig" },
        .target = target,
        .optimize = optimize,
        .single_threaded = true,
    });
1 Like