Build including mecha fails with no field named 'root_source_file' in struct 'Build.CreateModuleOptions'
jdrempel opened this issue · 2 comments
jdrempel commented
Zig version: 0.11.0
OS: Pop!_OS 22.04 LTS
Hello! I am trying to include mecha
in my project and when running zig build
I get the error in the issue title:
/home/jeremy/.cache/zig/p/12203ee851cb0451f3ebdf23b51cf21886e261a563b5b1e1ec16c801dc3ef9ecea5d/build.zig:8:45: error: no field named 'root_source_file' in struct 'Build.CreateModuleOptions'
const module = b.addModule("mecha", .{ .root_source_file = .{ .path = "mecha.zig" } });
^~~~~~~~~~~~~~~~
/usr/local/lib/zig/std/Build.zig:680:33: note: struct declared here
pub const CreateModuleOptions = struct {
^~~~~~
referenced by:
runBuild__anon_47132: /usr/local/lib/zig/std/Build.zig:1638:27
remaining reference traces hidden; use '-freference-trace' to see all reference traces
I am fetching mecha
through the built-in package manager - here's the relevant excerpt from build.zig.zon
:
.dependencies = .{
.mecha = .{
.url = "https://github.com/Hejsil/mecha/archive/5d572b31b08268e977bd52ba6701dfea6bf08025.tar.gz",
.hash = "12203ee851cb0451f3ebdf23b51cf21886e261a563b5b1e1ec16c801dc3ef9ecea5d",
},
},
And a snippet from my build.zig
:
const exe = b.addExecutable(.{
.name = "openmunge",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.addModule("mecha", mecha.module("mecha"));
b.installArtifact(exe);
Any idea whether this is something I'm doing wrong? Thanks in advance.
Hejsil commented
The master branch of mecha targets zig master. There is no guarantee that older version of zig can compiler master. Use on of the mecha releases if you need a version that compilers with at specific version of zig
jdrempel commented
Ah I see, I wrongly assumed master
targeted the latest stable zig release. Thanks for the info. :)