TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Zig build system

185 点作者 SerCe大约 2 年前

14 条评论

kristoff_it大约 2 年前
The Zig build system is now able to run tasks in parallel. To avoid overloading the system (ie to prevent OOM) it asks you to define MaxRSS for each task, resulting in pretty sweet usage consumption: <a href="https:&#x2F;&#x2F;ibb.co&#x2F;FW9kpxT" rel="nofollow">https:&#x2F;&#x2F;ibb.co&#x2F;FW9kpxT</a><p>On a M1 Ultra studio (the same from my screenshot above) it takes me 6 mins to run the entire compiler test suite for arm64-linux (I do development in a Linux VM), which is pretty sweet.<p>Note that this is one stepping stone for getting good performance from Zig, but it&#x27;s not yet incremental compilation with in-place binary patching [1]. That&#x27;s still a work in progress.<p>[1] <a href="https:&#x2F;&#x2F;kristoff.it&#x2F;blog&#x2F;zig-new-relationship-llvm&#x2F;" rel="nofollow">https:&#x2F;&#x2F;kristoff.it&#x2F;blog&#x2F;zig-new-relationship-llvm&#x2F;</a>
评论 #35571349 未加载
评论 #35570382 未加载
AndyKelley大约 2 年前
If you want to see a fun example of this build system in action, have a look at my ffmpeg fork which has the build system ported to zig build:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;andrewrk&#x2F;ffmpeg">https:&#x2F;&#x2F;github.com&#x2F;andrewrk&#x2F;ffmpeg</a><p>Particularly interesting is the use of nasm as a package dependency, which is executed to compile many assembly files into object files, which are then linked into the ffmpeg static library.<p>I&#x27;m using this package in a work-in-progress reboot of Groove Basin (a music player server) in Zig:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;andrewrk&#x2F;groovebasin&#x2F;tree&#x2F;zig-pkg">https:&#x2F;&#x2F;github.com&#x2F;andrewrk&#x2F;groovebasin&#x2F;tree&#x2F;zig-pkg</a><p>Point being that if you want to collaborate on the music player project, you don&#x27;t need to screw around with a million system dependencies, it&#x27;s just `zig build` and you&#x27;re off to the races - no matter whether you are using Windows, macOS, or Linux.<p>The zig build system is under heavy construction during this release cycle of Zig. I recommend to check it out at the end of May when Zig 0.11.0 is released, and a few more issues will be smoothed over. Of course, if you want to get your hands dirty and help work on a bleeding-edge build system &amp; package manager, come on over and give master branch a try.
评论 #35573938 未加载
jedisct1大约 2 年前
libsodium is written in C and Assembly, but uses Zig as an alternative to autoconf&#x2F;make&#x2F;etc.<p>Builds are <i>much</i> faster than with make, and it makes it very easy to cross-compile to other platform, includes Windows, Linux with specific glibc versions, and WebAssembly.<p>In fact, it was the easiest to build Linux binaries for .NET, that have to support glibc back to version 2.17, but on a recent OS, with a recent compiler toolchain.
评论 #35570159 未加载
quirino大约 2 年前
I&#x27;ve been confused by the statement that &quot;Zig can compile C Code&quot; for quite some time and reading a couple of blog posts hasn&#x27;t made it much clearer.<p>Does the Zig Project include a full blown C Compiler? Is it the Zig Compiler with some sort of adaptation to compile C code? Or does it use something like Clang behind the curtains? (In this case it would be responsible for some other parts of the compilation process)
评论 #35567786 未加载
评论 #35567691 未加载
评论 #35567906 未加载
评论 #35568941 未加载
eggy大约 2 年前
Glad to see a Zig Build for Raylib. I am using Zig to compile most of my C stuff now as I learn Zig. This makes Zig much more attractive to anyone considering learning it. It&#x27;s easier than Make and CMake for me.
评论 #35571966 未加载
eru大约 2 年前
Interesting. I wonder if it allows adding dependencies at runtime? (As explained in eg <a href="http:&#x2F;&#x2F;simonmar.github.io&#x2F;bib&#x2F;papers&#x2F;shake.pdf" rel="nofollow">http:&#x2F;&#x2F;simonmar.github.io&#x2F;bib&#x2F;papers&#x2F;shake.pdf</a> )
评论 #35568755 未加载
Hnus大约 2 年前
Can you debug zig in any MS&#x2F;jetbrains IDEs? I type in nvim but debug in whatever has the best experience. I think I asked this question like 2 years ago and was told you can write tests, use lsp server or look at assembly.. has situation improved?
评论 #35569432 未加载
评论 #35569393 未加载
评论 #35569410 未加载
评论 #35568729 未加载
评论 #35568721 未加载
adelm大约 2 年前
I take it so that zig build system is Turing complete, isn&#x27;t it? There is a reason why, for example, meson build system DSL is made to be non-Turing complete. It makes reasoning much simpler.
评论 #35569495 未加载
评论 #35568876 未加载
评论 #35568808 未加载
scrubs大约 2 年前
I&#x27;m holding my breath. The first day out I ran into a link problem. Zig linked statically not dynamically as instructed and while the task was produced, it didn&#x27;t work anyway. That&#x27;s not gonna be fixed I believe until 0.11.0. now to give credit where due, the head guy (Andrew if I recall) had already found this issue or a good part of it.
synergy20大约 2 年前
zig looks like a &#x27;better C&#x27;, is there a list of something it does better than C(e.g. integer promotion,UB,etc), so that I should embrace it quickly and start to use it in my embedded projects? would like to see a comparison table between zig vs c (or even c++)
评论 #35571907 未加载
评论 #35569203 未加载
评论 #35571758 未加载
评论 #35569337 未加载
评论 #35569395 未加载
Alifatisk大约 2 年前
Why is Zigs syntax so ... foreign?
评论 #35567781 未加载
评论 #35568244 未加载
评论 #35567532 未加载
malkia大约 2 年前
But why?
rtkwe大约 2 年前
Someone needs to make a competing build system called Zag, just so I can eventually make the joke &quot;we Zigged where we should have Zagged&quot; after Zig has some major issue in our build env.
评论 #35577647 未加载
评论 #35570710 未加载
评论 #35575661 未加载
diimdeep大约 2 年前
Looks like people behind Zig decided to drop support for macOS Catalina, OS released just 3 years ago. So it is not possible to compile Zig for it. It is ridiculous. <a href="https:&#x2F;&#x2F;github.com&#x2F;ziglang&#x2F;zig&#x2F;issues&#x2F;13313#issuecomment-1296440303">https:&#x2F;&#x2F;github.com&#x2F;ziglang&#x2F;zig&#x2F;issues&#x2F;13313#issuecomment-129...</a>
评论 #35569441 未加载
评论 #35569609 未加载
评论 #35569329 未加载
评论 #35569510 未加载
评论 #35570604 未加载