Jak opravit pád cargo: error: failed to run custom build command for `hdf5-sys v0.8.1`
Problém
Během cargo build nebo cargo run se zobrazí chybová zpráva jako
cargo-hdf5-sys-error.txt
error: failed to run custom build command for `hdf5-sys v0.8.1`
Caused by:
process didn't exit successfully: `/home/uli/dev/Versatile/RustyMatrix/target/debug/build/hdf5-sys-555129b7288a757c/build-script-build` (exit status: 101)
--- stdout
Attempting to find HDF5 via pkg-config...
cargo:rerun-if-env-changed=HDF5_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=HDF5_STATIC
cargo:rerun-if-env-changed=HDF5_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' (963963) panicked at /home/uli/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hdf5-sys-0.8.1/build.rs:548:13:
Unable to locate HDF5 root directory and/or headers.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...Řešení
Váš Rust projekt závisí na crate hdf5-sys, který zase závisí na systémové knihovně hdf5.
Zatímco byste ji mohli nainstalovat pomocí sudo apt -y install libhdf5-dev, v závislosti na vaší verzi Ubuntu by to mohlo nainstalovat verzi, kterou crate hdf5-sys nepodporuje.
Proto doporučuji upravit Cargo.toml tak, aby specificky povolil feature static, která přímo zkompiluje kompatibilní verzi libhdf5.
Cargo.toml
hdf5 = "0.8.1"
hdf5-sys = { version = "0.8.1", features = ["static"] }Poté můžete zkusit znovu spustit cargo příkaz.
Podívejte se na podobné články podle kategorie:
Rust
Pokud vám tento článek pomohl, zvažte, zda mi nekoupíte kávu nebo nepřispějete přes PayPal na podporu výzkumu a publikování nových článků na TechOverflow