Trying to understand a bit, I have some… interestingly large zig binaries and I’d like to know why they’re so big.
I suspect they’re my C dependencies but it would be nice to know which ones are contributing to the size,
Unfortunately both bloaty on unix platforms and sizebench aren’t quite up to the task falling over on differences in debug data, wondering if anyone else has other options
1 Like
What version are you using? It might be related to Zig custom backend for debug builds. You may want to switch to the LLVM backends. You can add .use_llvm = true to you exes in build.zig and see if that makes it so those can handle the executables.
2 Likes
The optimization mode makes a huge difference. even more than what one might expect.
As an anecdotal example, I have been porting mruby’s build system that relies upon a Ruby installation on the host to purely Zig’s build system, as that was an area that I felt weak on and wanted to learn more about. I too was baffled by the difference in binary size and assumed I was doing something incorrect. For reference, test projects would vary from +14 MB for a Debug build using the native backend, to ~2 MB (and under) using ReleaseFast and ReleaseSmall modes with LLVM.
Moral of the story is that I ignore binary size unless it is still happening with a release build, though I am unsure if that is the same issue you are experiencing, as you didn’t indicate your build configuration.
1 Like
interesting… i can use the llvm backend as a proxy for now for the zig binary.