Comment corriger l'erreur cargo build : The system library required by crate was not found.

Problème

Lors de la compilation d’un projet Rust avec Cargo, vous pourriez rencontrer une erreur comme celle-ci :

cargo_libpcsclite_hint.sh
The system library `libpcsclite` required by crate `pcsc-sys` was not found.
The file `libpcsclite.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
The PKG_CONFIG_PATH environment variable is not set.

Solution

La solution se trouve sous le message d’erreur dans la sortie cargo. Selon votre distribution Linux, vous devez installer le paquet de développement approprié qui fournit le fichier libpcsclite.pc.

cargo_libpcsclite_hint.sh
HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `libpcsclite.pc`.

If you are using Debian (or a derivative), try:

    $ sudo apt install pkgconf libpcsclite-dev

If you are using Arch (or a derivative), try:

    $ sudo pacman -S pkgconf pcsclite

If you are using Fedora (or a derivative), try:

    $ sudo dnf install pkgconf pcsc-lite-devel

Consultez les articles similaires par catégorie : Rust