libudev-sys-azul 0.1.4

dlopen-based drop-in fork of libudev-sys: loads libudev at runtime via libloading, with no build-time native link, so dependents (e.g. gilrs) cross-compile to hosts without libudev. API-identical to libudev-sys 0.1.4.
Documentation
  • Coverage
  • 1.18%
    1 out of 85 items documented0 out of 84 items with examples
  • Size
  • Source code size: 18.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 736.4 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • fschutt/libudev-azul
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fschutt

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-sys link-binds libudev at build time (its build.rs runs pkg_config::find_library("libudev").unwrap()), which fails when cross-compiling to a host that has no libudev (e.g. cargo build --target x86_64-unknown-linux-gnu from macOS).
  • libudev-sys-azul has no build.rs and no links = "libudev". Every function loads libudev.so lazily at runtime via libloading and 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 not libudev is present on the build host.
  • If libudev.so is 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:

[dependencies]
libudev-sys = { package = "libudev-sys-azul", version = "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 a package = rename (it emits patch ... was not used in the crate graph and resolves the original libudev-sys instead). 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 -azul forks: 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.