Smithay/udev-rs

hwdb maybe not available in libudev

a1ien opened this issue · 4 comments

a1ien commented

Since libudev-sys optional enable hwdb module

https://github.com/dcuddeback/libudev-sys/blob/54bba8a427b25a2c62c6b4b259b9e15bd225911f/build.rs#L41

https://github.com/dcuddeback/libudev-sys/blob/54bba8a427b25a2c62c6b4b259b9e15bd225911f/src/lib.rs#L7

We can get error if libudev build without hwdb

example error

error[E0412]: cannot find type `udev_hwdb` in crate `ffi`
  -->  /cargo/registry/src/github.com-1ecc6299db9ec823/udev-0.5.1/src/hwdb.rs:18:21
   |
18 |     hwdb: *mut ffi::udev_hwdb,
   |                     ^^^^^^^^^ not found in `ffi`

introduced in #21 ping @woodruffw

Alright, so the solution I am seeing is to make hwdb optional in udev-rs (via a feature) and make that require the hwdb feature of libudev-sys?

Should be easy enough to do. Do you want to make a PR?
Otherwise I will probably do this in a couple of days.

Thanks for the ping. I wasn't aware that libudev could be built without hwdb support. I can try and make a PR to feature-test it out over the weekend, if nobody gets to it first 🙂

Well currently you cannot, but everything related to hwdb should be in the corresponding module, so it should be easy to fix.
Then udev-rs could still be used in environments without hwdb-support.

I would even suggest to disable hwdb support by default. Everyone needing the feature, cannot run where hwdb is not available anyway, while others remain compatible instead of breaking when updating to 0.5.1 on some systems.

I should probably even yank 0.5.1 once this is fixed. This is definitely a regression.

Fixed in 0.6.0.

hwdb is now by default disable, to opt-in this api you would need to use the hwdb feature.
Also 0.5.1 is yanked to not break building udev 0.5 projects, that have no use for hwdb.