Skip to content

zfs: pass kernel build flags correctly - #435553

Merged
vcunat merged 1 commit into
NixOS:staging-nextfrom
alyssais:zfs-cc-unwrapped
Aug 21, 2025
Merged

vcunat merged 1 commit into
NixOS:staging-nextfrom
alyssais:zfs-cc-unwrapped

Conversation

@alyssais

Copy link
Copy Markdown
Member

ZFS's autoconf scripts recognize KERNEL_CC, KERNEL_CROSS_COMPILE, KERNEL_ARCH, etc. This avoids the need to separately give them as Make flags, although I'm not sure what the original intention behind giving the unprefixed flags to configure was — the commit adding that doesn't say, except that it was to fix cross, which still works after this change.

This fixes the ZFS kernel module build after the change to use unwrapped compilers for building the kernel, which previously resulted in CC etc. being clobbered for the ZFS build, even for non-kernel parts like the "compiler works" Autoconf check.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

ZFS's autoconf scripts recognize KERNEL_CC, KERNEL_CROSS_COMPILE,
KERNEL_ARCH, etc.  This avoids the need to separately give them as
Make flags, although I'm not sure what the original intention behind
giving the unprefixed flags to configure was — the commit adding that
doesn't say, except that it was to fix cross, which still works after
this change.

This fixes the ZFS kernel module build after the change to use
unwrapped compilers for building the kernel, which previously resulted
in CC etc. being clobbered for the ZFS build, even for non-kernel
parts like the "compiler works" Autoconf check.
"--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
]
++ kernelModuleMakeFlags
++ map (f: "KERNEL_${f}") kernelModuleMakeFlags

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This scares me a little bit if we happen to introduce variables that shouldn’t get the KERNEL_ prefix later, but I guess at worst it’d most likely be harmless.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My thoughts exactly. It would be strange for ZFS to introduce a variable called KERNEL_X that is for something other than setting the X passed to the kernel..

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 12.approvals: 1 This PR was reviewed and approved by one person. labels Aug 21, 2025
@amarshall

Copy link
Copy Markdown
Member

the commit adding that doesn't say … after the change to use unwrapped compilers

Could you reference these changes directly?

@Shawn8901

Shawn8901 commented Aug 21, 2025 •

Copy link
Copy Markdown
Contributor

the commit adding that doesn't say … after the change to use unwrapped compilers

Could you reference these changes directly?

That pr introduced that #402198

@vcunat
vcunat merged commit bbcae39 into NixOS:staging-next Aug 21, 2025
@alyssais
alyssais deleted the zfs-cc-unwrapped branch March 27, 2026 11:52
@n0099

n0099 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

although I'm not sure what the original intention behind giving the unprefixed flags to configure was — the commit adding that doesn't say,

cfe5a79#diff-65503e1f59ebff07b9456a6616fc40d19f831947faf6323991e4ceb94a6a7a59R142 of #230498

@n0099

n0099 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This breaks #473637

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

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants