From 6519e3fb71d167b435fa73ff7b06c338e5ef5714 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 1 Aug 2025 21:58:28 +0100 Subject: [PATCH] linuxHeaders: fix build on 32-bit systems with 64-bit inodes Without the change builx of `pkgsi686Linux.linuxHeaders` fails on my `btrfs` with 64-bit inodes as: linux-headers> fixdep: error fstat'ing file: scripts/basic/.fixdep.d: Value too large for defined data type Normally `Kbuild` attempts to pass correct LFS flags by extracting them from `getconf` as: HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null) But `nixpkgs` does not provide it and the build fails. The change hardcodes LFS flags for 32-bit systems. --- pkgs/os-specific/linux/kernel-headers/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index 371eb343f74d..cd91b50d8df7 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -90,6 +90,16 @@ let # `$(..)` expanded by make alone "HOSTCC:=$(CC_FOR_BUILD)" "HOSTCXX:=$(CXX_FOR_BUILD)" + # To properly detect LFS flags 32-bit build environments like + # pkgsi686Linux.linuxHeaders Kbuild uses this Makefile bit: + # HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null) + # + # `getconf` is not available in early bootstrap and thus the + # build fails on filesystems with 64-bit inodes as: + # linux-headers> fixdep: error fstat'ing file: scripts/basic/.fixdep.d: Value too large for defined data type + # + # Let's hardcode subset of the output of `getconf` for this case. + "HOST_LFS_CFLAGS=-D_FILE_OFFSET_BITS=64" ]; # Skip clean on darwin, case-sensitivity issues.