Skip to content

Use Zig for GHC build and do dynamic glibc#2657

Open
plajjan wants to merge 2 commits intomainfrom
dynglibc
Open

Use Zig for GHC build and do dynamic glibc#2657
plajjan wants to merge 2 commits intomainfrom
dynglibc

Conversation

@plajjan
Copy link
Contributor

@plajjan plajjan commented Feb 20, 2026

No description provided.

The key change here is that the GHC/Stack build path now goes through Zig CC.
Once Zig is the compiler driver in that path, we can explicitly choose which
GNU libc version we target instead of inheriting whatever happens to be on the
build host.

On Linux, the Zig wrapper scripts accept ACTON_ZIG_GLIBC_VERSION and derive a
-target of the form <host-arch>-linux-gnu.<major.minor> from zig env, so we do
not hard-code CPU architecture while still pinning a glibc baseline.

If an explicit target is already supplied, it takes precedence. macOS behavior
is unchanged.

The Makefile now defaults ACTON_ZIG_GLIBC_VERSION to 2.31 on Linux and exports
it, and the dev guide documents the knob. In practice this gives us deliberate
control over glibc compatibility for the compiler build products.
We now dynamically link glibc on Linux on x86_64 while keeping other
libs static, just like we already do for aarch64.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b232e7d7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

rm -f dist/bin/actonc
cd compiler && sed 's,^version: BUILD_VERSION,version: "$(VERSION)",' < lib/package.yaml.in > lib/package.yaml
cd compiler && unset CC && unset CXX && unset CFLAGS && stack build acton lsp-server-acton --dry-run 2>&1 | grep "Nothing to build" || \
cd compiler && $(STACK) build acton lsp-server-acton --dry-run 2>&1 | grep "Nothing to build" || \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add dist/zig dependency for compiler target

dist/bin/acton now invokes $(STACK) at this line, and $(STACK) is defined to use compiler/tools/zig-cc.sh/zig-cxx.sh, which abort when dist/zig/zig is not present. Because the target prerequisites still do not include $(DIST_ZIG), running make dist/bin/acton directly (or in a parallel flow that has not built Zig yet) can fail nondeterministically before the build starts; declaring the Zig artifact as an explicit prerequisite would make this target reliable.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant