For a few days now, every time I run zig build in my project it appears to spend ~6 seconds in the “Configure” phase before even starting the build steps:
It only seems to happen within my project (it also happens if I reclone it), but not in a new zig inited project. Does anyone know what Zig does during that step? Has anyone else encountered this in the past?
I haven’t changed anything on my system, particularly I did not update the compiler (I’m currently stuck on version 0.15.0-dev.1034+bd97b6618) and my build.zig didn’t change in a relevant way in the past 2 weeks.
Maybe you can use --time-report to see what is taking a long time?
It doesn’t look to me as if that currently shows anything about the configure phase, but maybe it gives a clue anyhow?
Also might make sense if the time report also included timings about the execution of the build runner and the configure and make phases, but I don’t know how feasible it would be to include that in the time report.
Another option to get more insight might be to use the tracy that is included in the compiler (I think it requires building the compiler with tracy enabled), but I haven’t tried that so I don’t know whether it would show useful information for this problem.
Indeed that was the problem, I added a dependency to a fork of the zig repo to use a modified test runner (I do it like this to make updating easier through the use of git rebase) and didn’t expect it to run the build.zig automatically. I removed the build.zig from the repo which fixed the issue.
Also I wonder if there is a way to disable the running of build.zig for dependencies.
Sadly that is not available in the zig version I’m using. I ended up just using git bisect to find the problem.
Hmm, I already did make it a lazy dependency. But I don’t have it behind an if statement, since I don’t want to hide the testing step behind a build flag.