kvmtool: fix build w/ glibc-2.38

Failing Hydra build: https://hydra.nixos.org/build/230541621

+27
+2
pkgs/applications/virtualization/kvmtool/default.nix
··· 10 10 sha256 = "sha256-wpc5DfHnui0lBVH4uOq6a7pXVUZStjNLRvauu6QpRvE="; 11 11 }; 12 12 13 + patches = [ ./strlcpy-glibc-2.38-fix.patch ]; 14 + 13 15 buildInputs = lib.optionals stdenv.hostPlatform.isAarch64 [ dtc ]; 14 16 15 17 enableParallelBuilding = true;
+25
pkgs/applications/virtualization/kvmtool/strlcpy-glibc-2.38-fix.patch
··· 1 + Manually tell the compiler that strlcpy exists. The `try-build` function seems 2 + somewhat broken, i.e. any code that I try to pass to it doesn't link because of an 3 + "undefined reference to main" error (and some more quoting issues with newlines being 4 + swalloed). 5 + 6 + Because both musl and glibc seemt o support strlcpy nowadays, I decided to just skip the 7 + possibly broken feature-check and hardcode that it exists. 8 + 9 + diff --git a/Makefile b/Makefile 10 + index ed2414b..37be9cd 100644 11 + --- a/Makefile 12 + +++ b/Makefile 13 + @@ -239,10 +239,8 @@ endif 14 + # On a given system, some libs may link statically, some may not; so, check 15 + # both and only build those that link! 16 + 17 + -ifeq ($(call try-build,$(SOURCE_STRLCPY),$(CFLAGS),$(LDFLAGS)),y) 18 + - CFLAGS_DYNOPT += -DHAVE_STRLCPY 19 + - CFLAGS_STATOPT += -DHAVE_STRLCPY 20 + -endif 21 + +CFLAGS_DYNOPT += -DHAVE_STRLCPY 22 + +CFLAGS_STATOPT += -DHAVE_STRLCPY 23 + 24 + ifeq ($(call try-build,$(SOURCE_BFD),$(CFLAGS),$(LDFLAGS) -lbfd -static),y) 25 + CFLAGS_STATOPT += -DCONFIG_HAS_BFD