On 01-08-22, 23:56, Kent Gibson wrote:
The Rust bindings themselves should be building against the local build tree, so well known relative paths.
Right, when we build everything with "make" we better use the already built library. I agree.
For users, require they have libgpiod installed and use pkg_config to locate it?
Is that what you mean?
Since we need the latest APIs, we can't trust the packages provided by distributions for now. i.e. "apt-get install libgpiod-dev" won't install the latest stuff we need.
The only other option to get it working in environments like rust-vmm-containers (which tests the vhost-device crate currently) is to build / install libgpiod first. As I have understood, people don't really like it there (Maintainers of rust-vmm-containers) as this will have further dependencies and require more tools.
I even tried to generate the libgpiod-sys bindings on the fly first, but it required more tooling and there were issues with Musl build specifically. They suggested to use prebuild bindings as a solution, which I have now.
What about we have two separate features:
- "default" one will be used with "make" and will use prebuild library.
- "generate" one will be used by user crates and we will build the files there like it is done now.
Else, how do other Rust crates wrapping dynamic C libraries do it?
I think for standard libraries that are stable, the -sys crates just contain the pre-built bindings and wrappers and expect the library to be already installed.