Manually download a transitive dependency

I’m new to zig and wanted to use it for embedded programming. It seems that MicroZig is a way to go for this purpose.

But then I tried to build MicroZig, but it relies on sqlite package, which internally has this in it’s build.zig.zon

.dependencies = .{
  .sqlite = .{
    .url = "https://www.sqlite.org/2025/sqlite-amalgamation-3490200.zip",
    .hash = "N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD",
  },
},

The problem is, my ISP blocks this url, so zig can not download it. I’ve tried using an http proxy to solve this, but it didn’t work because zig now errors with this: error: invalid HTTP response: HttpConnectionClosing (or probably also something else, I’ve tried different proxy setups).

So the question is - is there a way to use manually downloaded sqlite instead of relying on zig to download it?

1 Like

Yep, just pass it to zig fetch:

$ zig fetch --help
Usage: zig fetch [options] <url>
Usage: zig fetch [options] <path>

    Copy a package into the global cache and print its hash.
    <url> must point to one of the following:
      - A git+http / git+https server for the package
      - A tarball file (with or without compression) containing
        package source
      - A git bundle file containing package source

Next time you run zig build it will find the cached thing and skip the network.

3 Likes

Oh, didn’t realize it’s possible to use zig fetch with a path. Thanks!

1 Like