Rustup-installed Rust on Fedora: Unable to find Libudev.pc
6
votes
3
answers
3233
views
I'm trying to build a rust app on fedora within a rustup environment that depends on libudev. At the moment I get the error when trying to compile the app with
cargo build --release
:
error: failed to run custom build command for libudev-sys v0.1.4
Caused by:
process didn't exit successfully: /home/me/myApp/target/release/build/libudev-sys-7d615f10fc24f9b2/build-script-build
(exit status: 101)
--- stdout
cargo:rerun-if-env-changed=LIBUDEV_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=LIBUDEV_STATIC
cargo:rerun-if-env-changed=LIBUDEV_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'called Result::unwrap()
on an Err
value: "\"pkg-config\" \"--libs\" \"--cflags\" \"libudev\"
did not exit successfully: exit status: 1\n--- stderr\nPackage libudev was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libudev.pc'\nto the PKG_CONFIG_PATH environment variable\nPackage 'libudev', required by 'virtual:world', not found\n"', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/libudev-sys-0.1.4/build.rs:38:41
In the past things worked fine on ubuntu (or any debian-based, using the system rust install not rustup) after doing sudo apt install libudev1 && sudo apt install libudev-dev
.
So far, I've tried or considered:
- looking at the advice in https://unix.stackexchange.com/questions/715215/unable-to-find-libudev-pc , most of that advice was particular to someone's homebrew / linuxbrew setup while this question is specific to Fedora with a Rustup installed rust environment.
- Tried updating my PKG_CONFIG_PATH
and checking things with PKG_CONFIG
, specifically:
1. See where the libraries are via yum provides */libudev.pc
, which reveals Filename : /usr/lib/pkgconfig/libudev.pc
& Filename : /usr/lib64/pkgconfig/libudev.pc
2. Add the lib folders to PKG_CONFIG_PATH
in my .bashrc
: PKG_CONFIG_PATH=$PATH:/usr/lib/pkgconfig/:/usr/lib64/pkgconfig
3. Start a new shell, run pkg-config --libs --cflags libudev
, which still gives an error
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
Package 'libudev', required by 'virtual:world', not found
4. Running pkg-config --variable pc_path pkg-config
shows /usr/lib64/pkgconfig:/usr/share/pkgconfig
- considered doing sudo dnf install libudev
, but hesitate since I'm using a rustup environment instead and installing that triggers installing the fedora system version of rust too.
Asked by Vivek Gani
(233 rep)
Nov 7, 2022, 05:48 PM
Last activity: Apr 15, 2025, 06:42 PM
Last activity: Apr 15, 2025, 06:42 PM