The previous aec_buffer_decode declaration used flat parameters which don't match the actual libaec C API; this caused a SIGSEGV at runtime. Replace with the correct aec_stream struct (mirroring <libaec.h>) and update filters_szip.rs to populate and pass &mut AecStream. Also add empty-input guard in szip_decode_impl and fallback library path search in build.rs for distros that omit the .pc file. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
28 lines
939 B
Rust
28 lines
939 B
Rust
fn main() {
|
|
if pkg_config::Config::new()
|
|
.atleast_version("1.0")
|
|
.probe("libaec")
|
|
.is_ok()
|
|
{
|
|
return; // pkg-config found libaec and emitted the link directives
|
|
}
|
|
// Fallback: look for libaec.so / libaec.a in standard library paths.
|
|
// libaec-dev on Debian/Ubuntu installs the library but omits the .pc file.
|
|
let lib_dirs = [
|
|
"/usr/lib/x86_64-linux-gnu",
|
|
"/usr/lib",
|
|
"/usr/local/lib",
|
|
"/usr/local/lib/x86_64-linux-gnu",
|
|
];
|
|
for dir in &lib_dirs {
|
|
let so = std::path::Path::new(dir).join("libaec.so");
|
|
let a = std::path::Path::new(dir).join("libaec.a");
|
|
if so.exists() || a.exists() {
|
|
println!("cargo:rustc-link-search=native={dir}");
|
|
println!("cargo:rustc-link-lib=aec");
|
|
return;
|
|
}
|
|
}
|
|
// libaec not found — szip feature will be unavailable but crate still compiles.
|
|
}
|