b0bleet / zvisor

Zig-based Hypervisor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What the Zig (large amounts of change required to compile)

shawndfisher opened this issue · comments

I'm getting a build error:

$ zig build
/home/sfisher/.dotfiles/asdf/.asdf/installs/zig/0.11.0/lib/std/Build/Step/Compile.zig:616:21: error: deprecated; use std.Build.installArtifact
pub const install = @compileError("deprecated; use std.Build.installArtifact");
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    build: /home/sfisher/dev/zvisor/build.zig:31:8
    runBuild__anon_7115: /home/sfisher/.dotfiles/asdf/.asdf/installs/zig/0.11.0/lib/std/Build.zig:1638:27
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Which I've been able to get around by changing the build.zig file:

const std = @import("std");

pub fn build(b: *std.Build) !void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});
    const root_source_file = std.Build.FileSource.relative("src/main.zig");

    // zvisor executable
    const zvisor_step = b.step("zvisor", "Install zvisor executable");

    const zvisor = b.addExecutable(.{
        .name = "zvisor",
        .root_source_file = root_source_file,
        .target = target,
        .optimize = optimize,
    });
    zvisor.linkSystemLibrary("c");

    const zvisor_install = b.addInstallArtifact(zvisor, .{});
    zvisor_step.dependOn(&zvisor_install.step);
    b.default_step.dependOn(zvisor_step);

    // Tests
    const test_step = b.step("test", "Run tests");

    const test_exe = b.addTest(.{
        .root_source_file = root_source_file,
        .optimize = optimize,
        .target = target,
    });

    const test_run = b.addRunArtifact(test_exe);
    test_run.step.dependOn(zvisor_step);
    test_step.dependOn(&test_run.step);
    b.default_step.dependOn(test_step);
}

However, after this point, lots of things are... unique... zig fmt src/* fixes a few issues, but I'm unsure about others. Any help would be appreciated.