I was trying to install a
spl-token-cli (link), using
cargo install spl-token-cli but I got the following error:
thread 'main' panicked at 'Unable to find libudev: `"pkg-config" "--libs" "--cflags" "libudev"` did not exit successfully: exit status: 1
error: could not find system library 'libudev' required by the 'hidapi' 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
Now I tried to add
libudev to my
configuration.nix or my
flake.nix (in the
buildInputs section) but they both gave me the error:
error: 'libudev' has been renamed to/replaced by 'udev'
So I replaced everything with
udev but I still got the
libudev not found error. How do I get rid of this error? Is it possible that I install some old version of
Because NixOS doesn’t work that way.
The TL’DR is to not use
cargo install, but to package with nix.
libudev was merged into systemd many years ago,
nativeBuildInputs = [ pkg-config ]; buildInputs = [ systemd ]' should solve your issue.
@jonringer Beautiful. I did exactly this and installation succeeded. Thank you so much!
I think I have the same problem as rollschild, however I’m a noob a using cli. so I’m now too sure how to run the nativeBuildInputs and buildInputs command. currently running ubuntu cli on my window system.
I think you might be a bit confused here. This is a forum for the Nix package manager. If you’re not using it, buildInputs, nativeBuildInputs etc. don’t apply to you.
I’d recommend asking in forums for your specific distro. The solution on other distros should be to install the systemd package though.
oh right. my apologies and thanks for letting me know.