joachimschmidt557 / linenoize

A port of linenoise to zig
MIT License
55 stars 9 forks source link

Using with zon package manager? #24

Closed glyh closed 4 months ago

glyh commented 4 months ago

Hello, I tried the following but it doesn't seem to be working?

In my zon file:

    .dependencies = .{
        .linenoise = .{
            .url = "git+https://github.com/joachimschmidt557/linenoize#123b52d72afa68f73d6b672b5f452e6e0e2f07d0",
            .hash = "1220b7658283f34fcf9bae428ab8fe17f79e219e06754363d9ed03eca2461c703a91",
        },
    },

And in my build.zig:

    const linenoize = b.dependency("linenoize", .{
        .target = target,
        .optimize = optimize,
    }).module("linenoize");

    exe.root_module.addImport("linenoize", linenoize);

Zig complains this :

thread 917704 panic: no dependency named 'linenoize' in '/home/lyh/Documents/Knowledge/Computer Science/Programming Languages/Macros/mal/build.zig.zon'. All packages used in build.zig must be declared in this file
/usr/lib/zig/std/Build.zig:1846:20: 0x115ed64 in findPkgHashOrFatal (build)
    std.debug.panic("no dependency named '{s}' in '{s}'. All packages used in build.zig must be declared in this file", .{ name, full_path });
                   ^
/usr/lib/zig/std/Build.zig:1909:40: 0x113366f in dependency__anon_14127 (build)
    const pkg_hash = findPkgHashOrFatal(b, name);
                                       ^
/home/lyh/Documents/Knowledge/Computer Science/Programming Languages/Macros/mal/build.zig:25:35: 0x10ec040 in build (build)
    const linenoize = b.dependency("linenoize", .{
                                  ^
/usr/lib/zig/std/Build.zig:2079:33: 0x10d1a43 in runBuild__anon_8820 (build)
        .Void => build_zig.build(b),
                                ^
/usr/lib/zig/compiler/build_runner.zig:300:29: 0x10cce82 in main (build)
        try builder.runBuild(root);
                            ^
/usr/lib/zig/std/start.zig:511:37: 0x10b45b5 in posixCallMainAndExit (build)
            const result = root.main() catch |err| {
                                    ^
/usr/lib/zig/std/start.zig:253:5: 0x10b40d1 in _start (build)
    asm volatile (switch (native_arch) {
    ^
???:?:?: 0x7 in ??? (???)
Unwind information for `???:0x7` was not available, trace may be incomplete

error: the following build command crashed:
/home/lyh/Documents/Knowledge/Computer Science/Programming Languages/Macros/mal/zig-cache/o/60fa30207beca99f165ff2fe7e4a868a/build /usr/bin/zig /home/lyh/Documents/Knowledge/Computer Science/Programming Languages/Macros/mal /home/lyh/Documents/Knowledge/Computer Science/Programming Languages/Macros/mal/zig-cache /home/lyh/.cache/zig --seed 0x6a37f0c -Z61231eedb0697d68
glyh commented 4 months ago

It turns out that this package is called linenoise under the hood instead of linenoize. Please document it.