You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a CI worker that runs Go's unit tests with CC="zig cc" on linux/amd64.
About zig cc
On Linux, zig cc is a wrapper on top of LLVM and LLD. Main benefits compared to other popular compilers:
Cross-compilation out of the box via a command-line flag.
Can dynamically link to a specified glibc version via a command-line flag (i.e. it generates a libc.so.6 on the fly before linking, no need to ship one).
For example:
CC="zig cc -target aarch64-linux-gnu.2.17" go build .
Will (cross-)compile the current package for linux/arm64 and link to glibc 2.17. Read this to learn more about zig cc.
Zig also has it's own Mach-O linker, making it possible to cross-compile to OS X. This is not in scope for this proposal, but may be considered as a next step. cc @kubkon who expressed interest in this.
Logistics
Initial changes:
Add a linux/amd64 worker that lack any C/C++ compiler (i.e. make sure gcc/ld are not installed).
Install zig v0.11 (to be released in May) to the worker.
The worker should have Zig upgraded when a new Zig version is released. This can be coordinated by Uber's Go team (cc @linzhp@sywhang) or Zig folks (cc @kubkon@andrewrk).
Why is this important?
As of writing a few companies are known to use zig cc to compile C/C++ (via this toolchain) and bundle it with Go code. My employer Uber uses zig cc to compile+link it's Go Monorepo for linux/amd64 and linux/arm64. During the last 4 months that we have been using zig cc in production (which included an upgrade to Go 1.20) we have encountered some issues in a released Go version that would have been caught in dev versions should zig cc worker be present:
Short Summary
Add a CI worker that runs Go's unit tests with
CC="zig cc"onlinux/amd64.About
zig ccOn Linux,
zig ccis a wrapper on top of LLVM and LLD. Main benefits compared to other popular compilers:libc.so.6on the fly before linking, no need to ship one).For example:
Will (cross-)compile the current package for
linux/arm64and link to glibc 2.17. Read this to learn more aboutzig cc.Zig also has it's own Mach-O linker, making it possible to cross-compile to OS X. This is not in scope for this proposal, but may be considered as a next step. cc @kubkon who expressed interest in this.
Logistics
Initial changes:
linux/amd64worker that lack any C/C++ compiler (i.e. make sure gcc/ld are not installed).zig v0.11(to be released in May) to the worker.CC="zig cc".Upkeep:
ReleaseSafe+Debugbuild, so, in case Zig crashes or trips an assertion, there will be decent information about the crash right in the logs. Refs Proposal: change nightlies from ReleaseFast to ReleaseSafe+debug ziglang/zig#15194.Why is this important?
As of writing a few companies are known to use
zig ccto compile C/C++ (via this toolchain) and bundle it with Go code. My employer Uber useszig ccto compile+link it's Go Monorepo forlinux/amd64andlinux/arm64. During the last 4 months that we have been usingzig ccin production (which included an upgrade to Go 1.20) we have encountered some issues in a released Go version that would have been caught in dev versions shouldzig ccworker be present:darwin/arm64would have triggered an assertion during linking with Zig.Since Go unit tests is a decent "integration" test, we believe it is a worth-while exercise to have this in CI.