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 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_PATHand checking things withPKG_CONFIG, specifically:- See where the libraries are via
yum provides */libudev.pc, which revealsFilename : /usr/lib/pkgconfig/libudev.pc&Filename : /usr/lib64/pkgconfig/libudev.pc - Add the lib folders to
PKG_CONFIG_PATHin my.bashrc:PKG_CONFIG_PATH=$PATH:/usr/lib/pkgconfig/:/usr/lib64/pkgconfig - Start a new shell, run
pkg-config --libs --cflags libudev, which still gives an errorPackage 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 - Running
pkg-config --variable pc_path pkg-configshows/usr/lib64/pkgconfig:/usr/share/pkgconfig
- See where the libraries are via
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.