Inject missing #include <errno.h> into zlib#58
Inject missing #include <errno.h> into zlib#58hmenke wants to merge 1 commit intoCyberShadow:masterfrom
Conversation
This has suddently started failing when building on NixOS 25.11.
gzread.c:24:5: error: use of undeclared identifier 'errno'
24 | errno = 0;
| ^~~~~
gzread.c:36:13: error: use of undeclared identifier 'errno'
36 | if (errno == EAGAIN || errno == EWOULDBLOCK) {
| ^~~~~
gzread.c:36:22: error: use of undeclared identifier 'EAGAIN'
36 | if (errno == EAGAIN || errno == EWOULDBLOCK) {
| ^~~~~~
gzread.c:36:32: error: use of undeclared identifier 'errno'
36 | if (errno == EAGAIN || errno == EWOULDBLOCK) {
| ^~~~~
gzread.c:36:41: error: use of undeclared identifier 'EWOULDBLOCK'
36 | if (errno == EAGAIN || errno == EWOULDBLOCK) {
| ^~~~~~~~~~~
5 errors generated.
I don't understand how this can be possible. We pin our Flake inputs..? Do you mean if you update the Flake inputs to use the latest nixpkgs? |
|
Sorry, I guess I should have mentioned that I override the flake input like so nix build .#btdu-static-x86_64 --override-input nixpkgs "github:NixOS/nixpkgs/nixos-25.11" |
|
Thanks. This seems like an upstream bug, have you checked if it has been reported to zlib? Do other projects apply similar patches? |
|
zlib blames the builder (madler/zlib#1126) and indeed I can see a build failure in |
|
Okay, the actual problem is that the compiler as it's configured currently cannot compile any executable. Attempting to compile a file with just an empty echo "int main() {}" > test.c
$CC $CFLAGS -o test test.c $LDFLAGSfails with |
|
Makes sense, the setup is pretty much only to support the specific cross build we need, so regular program compilation might be broken, but maybe we should fix that to make |
|
This seems to work. diff --git a/flake.nix b/flake.nix
index 7c7eb1b..406509e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -144,7 +144,7 @@
configurePhase = ''
# Use musl headers and disable glibc's FORTIFY_SOURCE
# Note: -w suppresses all warnings, needed because zlib's configure checks for any stderr output
- export CC="${pkgs.llvmPackages.clang-unwrapped}/bin/clang --target=${targetTriple}"
+ export CC="${pkgs.llvmPackages.clang-unwrapped}/bin/clang --target=${targetTriple} -nostdlib"
export AR="${pkgs.llvmPackages.bintools-unwrapped}/bin/llvm-ar"
export RANLIB="${pkgs.llvmPackages.bintools-unwrapped}/bin/llvm-ranlib"
export CFLAGS="-isystem ${muslLibc.dev}/include -flto=thin -O2 -U_FORTIFY_SOURCE -w" |
This has suddently started failing when building on NixOS 25.11.