If you use a custom cross container with a cross compiled version of the hdf5 library, there are a few issues that prevent the build of the hdf5-sys rust library.
e.g.,
create a container with a version of the hdf5 library for another architecture and you tell it to find the package config file:
The default looks in the wrong place for the binary, it looks in /usr/lib/arm-linux-gnueabihf/usr/include/hdf5/serial because it cant find the hdf5.pc file:
error: failed to run custom build command for `hdf5-sys v0.8.1`
Caused by:
process didn't exit successfully: `/target/debug/build/hdf5-sys-c1e87a537622b7ea/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_ALLOW_CROSS_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_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_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=SYSROOT
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_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_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_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7_unknown_linux_gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
Found HDF5 pkg-config entry
Include paths:
- "/usr/lib/arm-linux-gnueabihf/usr/include/hdf5/serial"
Link paths:
- "/usr/lib/arm-linux-gnueabihf/usr/lib/arm-linux-gnueabihf/hdf5/serial"
Unable to locate HDF5 headers from pkg-config info.
Found HDF5 headers at:
"/usr/include/hdf5/serial"
Adding to link path:
"/usr/lib/x86_64-linux-gnu/hdf5/serial"
Parsing HDF5 config from:
"/usr/include/hdf5/serial/H5pubconf.h"
Looking for HDF5 library binary...
Adding extra link paths (ld)...
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu64
/usr/local/lib64
/lib64
/usr/lib64
/usr/local/lib
/lib
/usr/lib
/usr/x86_64-linux-gnu/lib64
/usr/x86_64-linux-gnu/lib
--- stderr
thread 'main' panicked at 'Unable to infer HDF5 library runtime version (can't find the binary).', /cargo/registry/src/index.crates.io-6f17d22bba15001f/hdf5-sys-0.8.1/build.rs:155:5
If you tell the set parameters to tell hdf5-sys build where to find the the binary anyway, the cross build still failes as it tries to link the library as the wrong architecture:
If you use a custom cross container with a cross compiled version of the hdf5 library, there are a few issues that prevent the build of the hdf5-sys rust library.
e.g.,
run
The default looks in the wrong place for the binary, it looks in
/usr/lib/arm-linux-gnueabihf/usr/include/hdf5/serial
because it cant find thehdf5.pc
file:run
Complains about the
wrong ELF class: ELFCLASS32
: