Skip to main content

get_library_dependencies

Function get_library_dependencies 

Source
pub fn get_library_dependencies(binary_path: &Path) -> Result<Vec<String>>
Expand description

Extract library dependencies from an ELF binary using readelf.

This is architecture-independent - readelf reads the ELF headers directly without executing the binary, unlike ldd which uses the host dynamic linker.

§Errors

Returns an error if:

  • The file does not exist
  • readelf is not installed (install binutils)
  • readelf fails for reasons other than “not an ELF file”

Returns Ok(Vec::new()) if the file is not an ELF binary (e.g., a text file).