Skip to content

Instantly share code, notes, and snippets.

@SamTebbs33
Last active June 23, 2019 14:48
Show Gist options
  • Save SamTebbs33/30769b94e76a01143ac80f97d4ca76b6 to your computer and use it in GitHub Desktop.
Save SamTebbs33/30769b94e76a01143ac80f97d4ca76b6 to your computer and use it in GitHub Desktop.
// build.zig
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const exe = b.addExecutable("exe", "import-build.zig");
b.default_step.dependOn(&exe.step);
}
//import-build.zig
const build = @import("@build");
pub fn main() void {
@compileLog(build);
}
// error
$ ../../zig/build/bin/zig build
| /home/sam/repos/pluto/memes/import-build.zig:1:15: error: unable to find '@build'
const build = @import("@build");
^
The following command exited with error code 1:
/home/sam/repos/zig/build/bin/zig build-exe /home/sam/repos/pluto/memes/import-build.zig --cache-dir /home/sam/repos/pluto/memes/zig-cache --name exe --cache on
exec failed
/home/sam/repos/zig/build/lib/zig/std/build.zig:772:36: 0x24cdc5 in std.build.Builder.exec (build)
std.debug.panic("exec failed");
^
/home/sam/repos/zig/build/lib/zig/std/build.zig:1594:52: 0x24989e in std.build.LibExeObjStep.make (build)
const output_path_nl = try builder.exec(zig_args.toSliceConst());
^
/home/sam/repos/zig/build/lib/zig/std/build.zig:1895:24: 0x23c68d in std.build.Step.make (build)
try self.makeFn(self);
^
/home/sam/repos/zig/build/lib/zig/std/build.zig:313:19: 0x239920 in std.build.Builder.makeOneStep (build)
try s.make();
^
/home/sam/repos/zig/build/lib/zig/std/build.zig:303:29: 0x2398ad in std.build.Builder.makeOneStep (build)
self.makeOneStep(dep) catch |err| {
^
/home/sam/repos/zig/build/lib/zig/std/build.zig:261:33: 0x23441a in std.build.Builder.make (build)
try self.makeOneStep(s);
^
/home/sam/repos/zig/build/lib/zig/std/special/build_runner.zig:137:17: 0x231318 in main (build)
builder.make(targets.toSliceConst()) catch |err| {
^
/home/sam/repos/zig/build/lib/zig/std/special/bootstrap.zig:134:47: 0x22eb06 in std.special.posixCallMainAndExit (build)
const tmp: PayloadType = root.main() catch |err| {
^
/home/sam/repos/zig/build/lib/zig/std/special/bootstrap.zig:57:5: 0x22e940 in std.special._start (build)
@noInlineCall(posixCallMainAndExit);
^
Build failed. The following command failed:
/home/sam/repos/pluto/memes/zig-cache/o/kDwrncsYPy-WFEshjKZFRiSMQa7bZWrMUgT8mdMd0GzWStmS3l47AT4O9dccYVi7/build /home/sam/repos/zig/build/bin/zig /home/sam/repos/pluto/memes /home/sam/repos/pluto/memes/zig-cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment