Skip to content

Commit

Permalink
publish 0.12.0 release party
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Apr 28, 2024
1 parent 6dd519d commit 814d674
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
5 changes: 2 additions & 3 deletions content/monthly/202404.org
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#+TITLE: 202404
#+DATE: 2024-04-18T21:59:49+0800
#+LASTMOD: 2024-04-18T22:02:51+0800
#+LASTMOD: 2024-04-28T10:40:58+0800
#+DRAFT: true
* 重大事件
* 观点/教程
Expand Down Expand Up @@ -46,7 +46,6 @@ u3@16b196367-u2@16b196367
#+end_src

通过前三个输出可以知道,每个 u3 实际占用一个字节,但当用在 packed 结构中,就会变成 3 个 bit。其中的 11001 就是字段 a b 混合后的值,且 a 是三位,b 是高两位。


- [[https://procmarco.com/blog/learnings-from-building-a-db-in-zig/][Learnings From Building a DB in Zig]] :: 作者分享了在一次 3 天的 Hackthon 中,使用 Zig 开发一个数据库的经历。
* 项目/工具
* [[https://github.com/ziglang/zig/pulls?page=1&q=+is%3Aclosed+is%3Apr+closed%3A2024-03-01..2024-04-01][Zig 语言更新]]
32 changes: 32 additions & 0 deletions content/news/2024-04-27-0.12.0-release-party.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#+TITLE: 0.12.0 Release Party
#+DATE: 2024-04-28T09:53:45+0800
#+LASTMOD: 2024-04-28T10:44:16+0800
#+AUTHOR: Jiacai Liu

2024-04-20,0.12.0 终于发布了,历时 8 个月,有 268 位贡献者,一共进行了 3688 次提交!下面是它的 Release notes:
- https://ziglang.org/download/0.12.0/release-notes.html

ZigCC 对这个文档进行了翻译、整理,供需要升级适配的朋友参考:
- [[https://course.ziglang.cc/update/upgrade-0.12.0][0.12.0 升级指南]]
- [[https://course.ziglang.cc/update/0.12.0-description][0.12.0 版本说明]]

为了庆祝这一盛事,ZigCC 决定在 2024-04-27 举行了一次线上的发行聚会,主要来讨论这次的版本,下面是视频回看地址:
- https://youtu.be/H0IqBNsH-9M
- https://www.bilibili.com/video/BV1Nb421Y7WX/

在这次会议上,主要讨论了两部分内容:

第一是构建系统,0.12.0 版本对用户来说,主要是稳定了构建系统的 API,这对于 Zig 生态的构建十分重要,如果某用户写了一个基础库,但是升级 Zig 版本后,就没法编译了,可以想象,这是很沮丧的事情。

Zig 的构建系统分为两部分:
- zon 文件,声明依赖, =zig fetch= 会去下载里面的依赖
- =build.zig= 文件,项目的构建器,由多个 Step 形成一个有向无环图,来驱动不同逻辑的进行,如安装头文件、编译静态链接库等。Step 里面最重要的是 Compile ,addTest、addExecutable 返回的都是它,主要功能是对代码进行编译。其他常见的 Step 还有
- ConfigHeader 配置要用的头文件
- InstallArtifact,将编译好的 lib 或 bin 安装到 zig-out 目录中

第二个是自己写的 x86 的后端,它可以不依赖 llvm 直接生成可以执行的汇编代码,这也是 [[https://github.com/ziglang/zig/issues/16270][make the main zig executable no longer depend on LLVM, LLD, and Clang libraries #16270]]
这个 issue 的基础。之前笔者以为所谓移除 llvm,是把 Zig 代码翻译成 C 代码,然后再有不同架构下的 C 编译器来生成最终的可执行文件,目前看这种想法是错误的,
尽管 Zig 有 C 这个后端,但目前看并不是解决这个 issue 专用的。

这就不得不好奇,Zig 团队难道要把生成所有架构下的二进制?还是说对于用的少的架构,[[https://github.com/ziglang/zig/issues/13265][直接生成 llvm 的 bc 文件]],然后剩下的活再交给 llvm 去做?
目前笔者还没有十分明确的答案,希望今后能尽快搞清楚这个问题,也欢迎了解的读者留言指出。

0 comments on commit 814d674

Please sign in to comment.