Sample Header Ad - 728x90

libudev not found in pkg-config search path in GitHub actions ubuntu-latest environment

1 vote
1 answer
1486 views
I'm setting up CI for a Rust application I'm developing that (indirectly) depends on the libudev-sys crate. Part of this CI means building my crate, which means also building libudev-sys. When the workflow runs and it gets to the build stage, cargo fails with this error message while attempting to build libudev-sys:
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libudev-sys-0.1.4/build.rs:38:41:
  called Result::unwrap() on an Err value:
  PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "libudev" did not exit successfully: exit status: 1
  error: could not find system library 'libudev' required by the 'libudev-sys' crate
Package libudev was not found in the pkg-config search path.
Perhaps you should add the directory containing `libudev.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libudev' found
  note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
I'm struggling to debug this because every change requires committing and pushing to the repo and then waiting for the workflow to run. This is not an error encountered on my own system. According to this page about the ubuntu-latest environment , systemd is installed (which provides libudev), as well as pkg-config from apt (so [this answer] in a related question doesn't apply). I have tried installing systemd with sudo apt-get update and sudo apt-get install systemd, but that shows that systemd is already installed. I also tried updating the PKG_CONFIG_PATH as per this answer , but this did not work either.
Asked by Zoe (41 rep)
Nov 18, 2023, 02:04 AM
Last activity: Nov 18, 2023, 02:24 AM