Compiler slow out of nowhere

Hi guys,

My compiler is taking a bunch of time to build my project, which has not been the case an hour ago:

~ zig build
Compile Build Script
└─ [6/6] Fetch Packages
   └─ c_kzg_4844

Btw this is some random Ethereum package a dependency is using.

I am not sure what further info can I provide, except that it built in like 4 seconds before, and the same branch is now taking like 5 minutes to build. I tried clearing the cache this time, but it didn’t produce any changes. I am definitely using the same version of Zig I used before.

Any ideas?

Probably the most important one is compiler version? You can obtain it using zig version.

Also is this windows or linux?

Yes of course, the version is 0.14.1. I manage the versions via ZVM. Using Linux.

I tried the following:

  1. Deleting global zig cache
  2. Deleting local zig cache
  3. Deleting zig out
  4. Running zvm clean

After running those commands, the issue was still there, though after a reboot of my machine, the compile times are back to normal.

Not sure what happened there, it’s really weird that fetching the package took that long.

How do I debug the compiler btw? Is there a verbosity flag when building? This is not the first time this happened to me.

This is the package in mind:

{
    .name = .c_kzg_4844,
    .version = "0.4.0",
    .paths = .{""},
    .dependencies = .{
        .c_kzg_4844 = .{
            .url = "https://github.com/ethereum/c-kzg-4844/archive/refs/tags/v0.4.0.tar.gz",
            .hash = "122037488cd5d62e856888f1bb206989fdcb02efcdbae8fc110df5395a12d4be5eb0",
        },
        .blst = .{ .path = "../blst" },
    },
    .fingerprint = 0xd135d14e27c91910,
}

It’s used in the zabi library.

1 Like

You might need to use a new hash for the dependency.
I think if you try deleting the hash from the ZON, it’ll recommend a new hash value for you to use.
The formatting of hashes changed sometime around 0.14.0, and if you’re still using the old style of hash, it’ll redownload the entire package each and every single time you compile instead of downloading it once and keeping it.

2 Likes

Yeah sorry, I kind of bungled the old hash → new hash upgrade so it redownloads old hash dependencies. You’re probably getting slow network combined with failure to cache. Upgrading to new hash format will solve the issue.

4 Likes

Yup, that was it. Thanks!

Apologies accepted, I felt like I was building Rust there for a second xD

6 Likes

This should be fixed now on master, thanks to marko03kostic. Sorry the delay!

2 Likes