libudev-sys-azul
A dlopen-based drop-in fork of libudev-sys 0.1.4.
The FFI surface is identical to upstream libudev-sys — the same opaque
structs and the same udev_* functions. The only difference is how libudev
is loaded:
- Upstream
libudev-syslink-bindslibudevat build time (itsbuild.rsrunspkg_config::find_library("libudev").unwrap()), which fails when cross-compiling to a host that has nolibudev(e.g.cargo build --target x86_64-unknown-linux-gnufrom macOS). libudev-sys-azulhas nobuild.rsand nolinks = "libudev". Every function loadslibudev.solazily at runtime vialibloadingand dispatches through a function pointer.
Consequences:
- No build-time native dependency, so anything depending on it
(
gilrs-core→gilrs) cross-compiles to any target whether or notlibudevis present on the build host. - If
libudev.sois not loadable at runtime, every function returns a zeroed value (null pointer /0), so the caller (e.g.gilrs) gracefully observes "no udev / no devices" and reports no gamepads — instead of failing to start.
It exists to let the azul GUI framework
cross-compile its gamepad support (gilrs) without a host libudev.
Usage
As a transparent replacement for libudev-sys (so consumers build unmodified),
rename the dependency in the crate that depends on libudev-sys:
[]
= { = "libudev-sys-azul", = "0.1" }
The local name stays libudev-sys, so the dependent's extern crate/use libudev_sys and libudev-sys/... feature refs keep working unchanged.
Note — you cannot do this with
[patch.crates-io]. Cargo's[patch]table matches the replacement to the patched crate by name and ignores apackage =rename (it emitspatch ... was not used in the crate graphand resolves the originallibudev-sysinstead). To push this fork down a transitive chain you must republish each intermediate crate with the dependency rename baked in — which is exactly why the whole gilrs chain exists as-azulforks:gilrs-azul→gilrs-core-azul→libudev-sys-azul.
Credit
This is a fork of libudev-sys by David Cuddeback
(https://github.com/dcuddeback/libudev-sys), used and distributed under its
original MIT license. All of the FFI bindings are his work; this fork only
swaps build-time linking for runtime dlopen. Thank you.
License
MIT — see LICENSE. Original copyright © 2015 David Cuddeback; fork modifications © 2026 Felix Schütt.