Skip to content

lix: fix build on darwin - #568529

Merged
RaitoBezarius merged 1 commit into
NixOS:masterfrom
victorhooi:lix-darwin-noexecstack
Sep 30, 2026
Merged

RaitoBezarius merged 1 commit into
NixOS:masterfrom
victorhooi:lix-darwin-noexecstack

Conversation

@victorhooi

@victorhooi victorhooi commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

A previous PR for libucontext here broke Lix for everybody on Apple, by setting NIX_LDFLAGS = "-z,noexecstack" on every platform (but Apple's ld64 doesn't have a -z option. Hence, Lix then fails to build on aarch64-darwin.

This fixes the issue, by setting the flag for ELF platforms only. Verified with nix-build -A lix succeeding on aarch64-darwin after, including installCheckPhase.

cc @RaitoBezarius

Disclosure: I used AI to help with the investigation of this fix, and for the fix.

97bf56b ("lix: link with -z,noexecstack") sets NIX_LDFLAGS to
"-z,noexecstack" on every platform. cc-wrapper prefixes each word of
NIX_LDFLAGS with -Wl, so clang hands `-z noexecstack` to the linker, and
Apple's ld64 has no -z option. Meson's compiler sanity check then fails
to link, and every Lix in lixPackageSets fails to build on
aarch64-darwin: https://hydra.nixos.org/build/347153371

Mach-O does not need the flag: ld64 leaves stacks non-executable unless
-allow_stack_execute is passed. lib.optionalString keeps the value
unchanged on ELF platforms, so no Linux derivation changes.

Assisted-by: Claude Code (Claude Opus 5.5)
@nixpkgs-ci
nixpkgs-ci Bot requested review from a team and TyceHerrman September 30, 2026 08:24
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs labels Sep 30, 2026
@RaitoBezarius
RaitoBezarius added this pull request to the merge queue Sep 30, 2026
Merged via the queue into NixOS:master with commit df1fd00 Sep 30, 2026
32 checks passed
@victorhooi
victorhooi deleted the lix-darwin-noexecstack branch September 30, 2026 09:20
MacroPower added a commit to MacroPower/dotfiles that referenced this pull request Oct 1, 2026
nixpkgs 97bf56b78 links every lix build with -z,noexecstack. Apple's
ld64 rejects -z, so meson's compiler check fails on darwin and the Mac
cannot build the pinned lix 2.94.2. Hydra hits the same failure, so
the binary cache has no darwin output either.

Upstream fixed this in NixOS/nixpkgs#568529 by limiting the flag to
ELF targets. This overlay mirrors that fix for the pinned revision on
darwin only, so Linux hosts keep their cached lix. Drop it once the
nixpkgs pin includes 31a68c07f.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants