#0.14 Zon update unable to find module

1 messages · Page 1 of 1 (latest)

manic sphinx
#

I am trying to add a library to my project. I have put this in build.zig

const tree_sitter_dep = b.dependency("tree_sitter", .{
        .target = target,
        .optimize = optimize,
    });
    main_module.addImport("tree_sitter", tree_sitter_dep.module("tree_sitter"));

and this in my zon

.tree_sitter = .{
            .url = "https://github.com/nihklas/zig-tree-sitter/archive/master.tar.gz",
            .hash = "tree_sitter-0.25.0-8heIf5lvAQAvNJTna3OlZjEF-wFoQFz6Z9vHAFCNtOlC",
        },

Why can't it find the package?

cosmic iris
#

dep's name is 'tree_sitter', but mod's name is 'tree-sitter'

manic sphinx
cosmic iris
#

it's how they chose to name it

#

dep's name should match the one in build.zig.zon (your choice), mod's name shoud match how it was defined in the dep's build.zig, ie

    const module = b.addModule("tree-sitter", .{
        .root_source_file = b.path("src/root.zig"),
        .target = target,
        .optimize = optimize,
    });
manic sphinx
#

hm, ok

#

that seems to have worked