LooseLab / Icarust

A fully featured MinKNOW simulator for testing read until experiments.
Mozilla Public License 2.0
17 stars 7 forks source link

Unable to locate HDF5 root directory and/or headers #2

Closed satriobio closed 9 months ago

satriobio commented 1 year ago

Trying to run Icarust@V0.3 on fresh ubuntu:20.04

$ sudo apt update
$ sudo apt install -y protobuf-compiler libprotobuf-dev
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ git clone https://github.com/LooseLab/Icarust.git
$ cd Icarust
$ cargo run --release -- --help
  Updating crates.io index
  .....
  Compiling hdf5-sys v0.8.1
  Compiling env_logger v0.7.1
  Compiling prost-derive v0.11.9
  Compiling hdf5-derive v0.8.1
  Compiling async-stream-impl v0.2.1
  Compiling clap_derive v3.2.25
  Compiling tokio-macros v2.1.0
  Compiling futures-macro v0.3.28
  Compiling thiserror-impl v1.0.49
  Compiling tracing-attributes v0.1.26
  Compiling pin-project-internal v1.1.3
  Compiling serde_derive v1.0.188
  Compiling async-stream-impl v0.3.5
  Compiling pretty_env_logger v0.4.0
error: failed to run custom build command for `hdf5-sys v0.8.1`

Caused by:
  process didn't exit successfully: `/home/ubuntu/Icarust/target/release/build/hdf5-sys-0ef1adc993760775/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
  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' panicked at /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/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...
satriobio commented 1 year ago

Workaround

sudo apt install -y libhdf5-serial-dev
Adoni5 commented 1 year ago

Nice one! I think sudo apt install -y libhdf5-dev might install the headers as well. Did you run that before installing libhdf5-serial-dev? Just wondering if both are required or not.

satriobio commented 1 year ago

Thanks for your comment. I found the compilation works without installing libhdf5-dev.

In addition is it a good idea to state the protoc version (>=libprotoc 3.6.1)? The protoc installed using apt in 20.04 is 3.6.1 (it is the latest in 22.04) and will throw following error

cargo run --release -- --help
   Compiling tokio-macros v2.1.0
   ...
   Compiling tokio-stream v0.1.14
   Compiling tokio-rustls v0.23.4
   Compiling ndarray-npy v0.8.1
   Compiling h2 v0.3.21
   Compiling tower v0.4.13
error: failed to run custom build command for `icarust v0.1.0 (/Icarust)`

Caused by:
  process didn't exit successfully: `/Icarust/target/release/build/icarust-4a69da8b985baa40/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=proto/minknow_api/minion_device.proto
  cargo:rerun-if-changed=proto/minknow_api/data.proto
  cargo:rerun-if-changed=proto/minknow_api/protocol.proto
  cargo:rerun-if-changed=proto/minknow_api/statistics.proto
  cargo:rerun-if-changed=proto/minknow_api/acquisition.proto
  cargo:rerun-if-changed=proto/minknow_api/manager.proto
  cargo:rerun-if-changed=proto/minknow_api/protocol_settings.proto
  cargo:rerun-if-changed=proto/minknow_api/basecaller.proto
  cargo:rerun-if-changed=proto/minknow_api/analysis_configuration.proto
  cargo:rerun-if-changed=proto/minknow_api/promethion_device.proto
  cargo:rerun-if-changed=proto/minknow_api/instance.proto
  cargo:rerun-if-changed=proto/minknow_api/log.proto
  cargo:rerun-if-changed=proto/minknow_api/keystore.proto
  cargo:rerun-if-changed=proto/minknow_api/rpc_options.proto
  cargo:rerun-if-changed=proto/minknow_api/device.proto
  cargo:rerun-if-changed=proto/

  --- stderr
  Error: Custom { kind: Other, error: "protoc failed: Unknown flag: --experimental_allow_proto3_optional\n" }
warning: build failed, waiting for other jobs to finish...

Workaround

PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
unzip protoc-3.15.8-linux-x86_64.zip
cp bin/protoc /usr/bin/
protoc --version