| Crates.io | alpm-soname |
| lib.rs | alpm-soname |
| version | 0.4.1 |
| created_at | 2025-10-07 18:47:53.703839+00 |
| updated_at | 2026-01-11 16:47:56.995819+00 |
| description | Library and command line interface for looking up soname data in an ALPM context |
| homepage | https://alpm.archlinux.page |
| repository | https://gitlab.archlinux.org/archlinux/alpm/alpm |
| max_upload_size | |
| id | 1872216 |
| size | 111,213 |
A library and command line interface for looking up soname data in an ALPM context
The examples below assume that the following shared object setup exists in a package file example-1.0.0-1-x86_64.pkg.tar.zst:
/usr/lib/libexample.so -> libexample.so.1
/usr/lib/libexample.so.1 -> libexample.so.1.0.0
/usr/lib/libexample.so.1.0.0
Here, /usr/lib/libexample.so.1.0.0 encodes the soname libexample.so.1 in its ELF dynamic section.
For the examples below, the environment variables are set as follows:
LIB_PACKAGE_PATH: example-1.0.0-1-x86_64.pkg.tar.zstBIN_PACKAGE_PATH: application-1.0.0-1-x86_64.pkg.tar.zstYou can use the subcommands to find the sonames provided by a package and the sonames required by a package.
The -v option can be used to set the verbosity level. (e.g. -v for debug and -vv for trace)
You can retrieve the sonames provided by the package:
alpm-soname get-provisions --lookup-dir 'lib:/usr/lib' "$LIB_PACKAGE_PATH" | tee "$OUTPUT_DIR/output.txt"
# lib:libexample.so.1
You can retrieve the sonames required by the package:
alpm-soname get-dependencies --lookup-dir 'lib:/usr/lib' "$BIN_PACKAGE_PATH" | tee "$OUTPUT_DIR/output.txt"
# lib:libexample.so.1
get-dependencies subcommand only returns the soname dependencies, that have a matching entry in the package's metadata.
If you are interested in all soname dependencies encoded in the ELF files of a package, you can use the get-raw-dependencies subcommand.
alpm-soname get-raw-dependencies $BIN_PACKAGE_PATH --output-format json | tee "$OUTPUT_DIR/output.txt"
# [{"name":"libc.so","version":"6"},{"name":"libexample.so","version":"1"}]
As demonstrated above, the output format can be set to json using the --output-format option.
To see which ELF files reference each dependency, add the --detail flag. When combined with JSON
output, the command then returns a structured list of ELF paths with their dependencies.
use std::{path::PathBuf, str::FromStr};
use alpm_soname::find_provisions;
use alpm_types::SonameLookupDirectory;
fn main() -> Result<(), alpm_soname::Error> {
let provisions = find_provisions(
PathBuf::from("example-1.0.0-x86_64.pkg.tar.zst"),
SonameLookupDirectory::from_str("lib:/usr/lib")?,
)?;
println!("{provisions:?}"); // [ SonameV2 { ... }, ...]
Ok(())
}
use std::{path::PathBuf, str::FromStr};
use alpm_soname::find_dependencies;
use alpm_types::SonameLookupDirectory;
fn main() -> Result<(), alpm_soname::Error> {
let dependencies = find_dependencies(
PathBuf::from("application-1.0.0-x86_64.pkg.tar.zst"),
SonameLookupDirectory::from_str("lib:/usr/lib")?,
)?;
println!("{dependencies:?}"); // [ SonameV2 { ... }, ...]
Ok(())
}
use std::path::PathBuf;
use alpm_soname::extract_elf_sonames;
fn main() -> Result<(), alpm_soname::Error> {
let elf_sonames = extract_elf_sonames(
PathBuf::from("application-1.0.0-x86_64.pkg.tar.zst"),
)?;
println!("{elf_sonames:?}"); // [ ElfSonames { path: ..., sonames: [Soname { ... }, ...] }, ...]
Ok(())
}
cli adds dependencies required for the alpm-soname command line interface.Please refer to the contribution guidelines to learn how to contribute to this project.
This project can be used under the terms of the Apache-2.0 or MIT. Contributions to this project, unless noted otherwise, are automatically licensed under the terms of both of those licenses.