Error Buildin librpm
This is my function to get the number of total installed packages on a system with rpm. I am building on Fedora 28
fn rpm() -> usize {
use librpm::*;
librpm::config::read_file(None).unwrap();
let cache = installed_packages();
let total_packages = cache.map(|_| ()).count();
}
I am getting an error
librpm_sys::delMacro(self.0, cstr.as_ptr());
| ^^^^^^^^ not found in `librpm_sys`
It's a bit hard to read the error since it looks misaligned, but it appears to be saying that delMacro is undefined.
That function would be defined by bindgen, and is ultimately defined by the librpm C library:
http://ftp.rpm.org/api/4.7.0/group__rpmmacro.html#g6365bacb2f43539de94cd6c275968311
You might check your rpm-libs version (it looks like Fedora 28 has 4.14?). That said, to my knowledge it's a relatively old function and one I wouldn't expect they'd remove, especially in a stable version.
It might be an issue with bindgen. You could try running cargo doc on the librpm-sys crate and seeing what functions are available.
You are correct Fedora uses 4.14. I ran cargo doc -p librpm-sys --open, Should I expect to see any functions that aren't crates.io's docs?
Do you see delMacro on your local copy of the docs?
https://rustrpm.org/librpm_sys/fn.delMacro.html
Yes I do
That's strange, because that error seems to indicate your local copy of librpm_sys is missing the delMacro function
I had this same issue, and my machine is using librpm 4.14.2. Is there any planned support for the API changes that came with 4.14?