Skip to content

Add build logic for zig cc #19535

@howardjohn

Description

@howardjohn

Title: Add build logic for zig cc

Description:
https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html can act as a drop in replacement for clang. This offers a few benefits over Envoy's current build:

  • Simplified cross-compiling - this would be pretty useful for us in particular, as our CI only has access to amd64 machines. Basic tests can be done under emulation but
  • Compiling against different GLIBC versions. We try to support running our builds of Envoy on old OS's, but because of GLIBC dependency that means we also need to build on older platforms. This can be challenging - for example Ubuntu 16 is now EOL which can make it harder to run builds on this version, but we still want to support users on this version. Keeping dependencies like llvm up to date becomes harder as well the older the OS is.
  • Faster ? Absolutely no proof here, but its plausible.

There is some third-party bazel integration: https://git.sr.ht/~motiejus/bazel-zig-cc

Overall as a project, this seems like this may be problematic - maintaining multiple build systems can cause a lot of burden and I assume we would not fully migrate everything to zig. However, I thought I would float the idea out.

I did experiment with this a few months back and was able to get a binary compiled. However, it crashed immediately for unclear reasons. I am not an expert on C++, zig, or bazel though so likely someone else could get much further

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildenhancementFeature requests. Not bugs or questions.stalestalebot believes this issue/PR has not been touched recently

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions