diff --git a/pkgs/build-support/kernel/make-initrd-ng/src/main.rs b/pkgs/build-support/kernel/make-initrd-ng/src/main.rs index 85449c7eb027..b04e546d388a 100644 --- a/pkgs/build-support/kernel/make-initrd-ng/src/main.rs +++ b/pkgs/build-support/kernel/make-initrd-ng/src/main.rs @@ -5,9 +5,7 @@ use std::fs; use std::hash::Hash; use std::iter::FromIterator; use std::os::unix; -use std::os::unix::fs::PermissionsExt; use std::path::{Component, Path, PathBuf}; -use std::process::Command; use libc::umask; @@ -159,13 +157,22 @@ fn add_dependencies + AsRef + std::fmt::Debug>( } } if !found { - // glibc makes it tricky to make this an error because - // none of the files have a useful rpath. - println!( - "Warning: Couldn't satisfy dependency {} for {:?}", - line, - OsStr::new(&source) - ); + // In Nix, glibc's own libraries lack rpath entries pointing to + // themselves, so the dynamic linker (ld-linux-*.so.*) and libc.so.* + // can never be resolved through rpath alone. They are always present + // in the initrd: the linker via elf.interpreter above, and libc via + // at least one binary's rpath. Suppress these known-benign cases. + // See also: the ld*.so.? skip in stage-1.nix findLibs. + let is_glibc_runtime = (line.starts_with("ld-") && line.contains(".so")) + || line.starts_with("libc.so"); + + if !is_glibc_runtime { + eprintln!( + "Warning: Couldn't satisfy dependency {} for {:?}", + line, + OsStr::new(&source) + ); + } } }