Hi all -
I’m getting an error when running build - here is the error -
andy@obsidian:~/Nanoscript$ zig build
/home/andy/Nanoscript/build.zig:78:8: error: no field or member function named 'addPackage' in 'Build.Step.Compile'
exe.addPackage(pkgs.lexer);
~~~^~~~~~~~~~~
/home/andy/zig/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
referenced by:
runBuild__anon_8818: /home/andy/zig/lib/std/Build.zig:2116:27
main: /home/andy/zig/lib/compiler/build_runner.zig:301:29
remaining reference traces hidden; use '-freference-trace' to see all reference traces
andy@obsidian:~/Nanoscript$
The relevant part of my build script is here -
// The following package build syntax is from here -
// https://github.com/zig-community/Zig-Showdown/blob/main/build.zig#L6-L62
const pkgs = struct {
const lexer = std.build.Pkg{
.name = "lexer",
.path = "src/lexer.zig",
};
const parser = std.build.Pkg{
.name = "parser",
.path = "src/parser.zig",
};
const semantic_analyzer = std.build.Pkg{
.name = "semantic_analyzer",
.path = "src/semantic_analyzer.zig",
};
};
// Add packages.
exe.addPackage(pkgs.lexer);
exe.addPackage(pkgs.parser);
exe.addPackage(pkgs.semantic_analyzer);
I should mention that this syntax is being used because I had an almost-identical error with the previous version of my build script which used this syntax -
exe.addPackagePath("lexer", "src/lexer.zig");
exe.addPackagePath("parser", "src/parser.zig");
exe.addPackagePath("semantic_analyzer", "src/semantic_analyzer.zig");
That syntax gave me “no field or member function named addPackagePath”.
I looked around and found the addPackage syntax shown above but that doesn’t work either.
I’m running on Linux Mint.
Zig version - 0.14.0-dev.14+ec337051a
Hoping someone can help! Many thanks in advance -
- mooseman