hdf5-rust icon indicating copy to clipboard operation
hdf5-rust copied to clipboard

Doesn't seem to register HDF5 1.14.2 as a version.

Open trippalamb opened this issue 2 years ago • 19 comments

Had to roll back to 1.10.10 in order for hdf5-sys to register a version of HDF5 during the cargo build process.

trippalamb avatar Sep 07 '23 16:09 trippalamb

Do you have the version string? In #243 I saw and implemented support for strings like 1.14.1.2

mulimoen avatar Sep 07 '23 18:09 mulimoen

I'm sorry. I don't understand what that means.

TrippLamb avatar Sep 19 '23 17:09 TrippLamb

If you look in the H5pubconf.h header of the install, what is the value of H5_VERSION?

mulimoen avatar Sep 19 '23 17:09 mulimoen

It is the same as this issue title "1.14.2"

/* Version number of package */
#define H5_VERSION "1.14.2"

trippalamb avatar Sep 19 '23 18:09 trippalamb

I'm having the same problem. On Arch linux 6.5.8 with the latest hdf5 1.14.2-1 package installed, cargo fails when building a project with hdf5 0.8.1 as a dependency. cargo build ends with the following error:

  Found HDF5 pkg-config entry
      Include paths:
      - "/usr/include"
      Link paths:
      - "/usr/lib"
  Located HDF5 headers at:
      "/usr/include"
  Parsing HDF5 config from:
      "/usr/include/H5pubconf.h"

  --- stderr
  thread 'main' panicked at /home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hdf5-sys-0.8.1/build.rs:200:21:
  Invalid H5_VERSION: "1.14.2"
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
     1: core::panicking::panic_fmt
               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
     2: build_script_build::Header::parse
     3: build_script_build::LibrarySearcher::finalize
     4: build_script_build::main
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

My /usr/include/H5pubconf.h header also reports version 1.14.2, same as @trippalamb:

/* Version number of package */
#define H5_VERSION "1.14.2"

loenard97 avatar Oct 23 '23 13:10 loenard97

Are you using the version from crates.io or using themaster branch from here?

mulimoen avatar Oct 23 '23 13:10 mulimoen

I was using cargo add hdf5, so the crates.io version. I tried again with the latest version from here and it works now. Thank you.

loenard97 avatar Oct 23 '23 14:10 loenard97

@aldanor Maybe we should release a new version soon?

mulimoen avatar Oct 23 '23 14:10 mulimoen

I'm having this problem as well on an M1 mac:

        Setting HDF5 root from environment variable:
            HDF5_DIR = "/opt/homebrew/opt/hdf5"
        Custom HDF5_DIR provided; rpath can be set via:
            RUSTFLAGS="-C link-args=-Wl,-rpath,/opt/homebrew/opt/hdf5/lib"
        On some OS X installations, you may also need to set:
            DYLD_FALLBACK_LIBRARY_PATH="/opt/homebrew/opt/hdf5/lib"
        Parsing HDF5 config from:
            "/opt/homebrew/opt/hdf5/include/H5pubconf.h"
      
        --- stderr
        thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hdf5-sys-0.8.1/build.rs:200:21:
        Invalid H5_VERSION: "1.14.2"

I've attempted setting those flags as suggested in the error.

nleroy917 avatar Oct 23 '23 15:10 nleroy917

@nleroy917 try to set the hdf5 dependency to the git repo in your Cargo.toml. That did it for me.

[dependencies]
hdf5 = { git = "https://github.com/aldanor/hdf5-rust.git" }

loenard97 avatar Oct 23 '23 15:10 loenard97

I just saw your comment above. Thank you, I will try this. I'm actually getting this build error in someone elses project, so I need to do a clone, change the Cargo.toml, then try a custom build... will report back...

nleroy917 avatar Oct 23 '23 15:10 nleroy917

@nleroy917 Is it possible to add an override? https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html

mulimoen avatar Oct 23 '23 15:10 mulimoen

😱 That worked super well. Even better since hdf5 was going to be a dependency of a dependency. I've got another problem now about not having a threadsafe version of hdf5 installed, but I think that one is unrelated to this issue 😅

nleroy917 avatar Oct 23 '23 16:10 nleroy917

Could be easier to use the static version of hdf5, try enabling the static feature (still only in master).

mulimoen avatar Oct 23 '23 16:10 mulimoen

Oh, it looks like its actually an issue with hdf5-sys:

thread 'main' panicked at ~/.cargo/git/checkouts/hdf5-rust-c1072d7a2617f7d8/26046fb/hdf5-sys/build.rs:697:17:
        Enabled feature "threadsafe" but the HDF5 library was not built with HDF5_ENABLE_THREADSAFE
        note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib -- -C 'link-args=-undefined dynamic_lookup -Wl,-install_name,@rpath/_snapatac2.cpython-311-darwin.so'` failed with code 101

Interestingly, I don't even have threadsafe set:

[patch.crates-io]
hdf5 = { git = "https://github.com/aldanor/hdf5-rust.git" }
hdf5-sys = { git = "https://github.com/aldanor/hdf5-rust.git", features = ["static", "zlib"]}

nleroy917 avatar Oct 23 '23 17:10 nleroy917

@nleroy917 try to set the hdf5 dependency to the git repo in your Cargo.toml. That did it for me.

[dependencies]
hdf5 = { git = "https://github.com/aldanor/hdf5-rust.git" }

If I do this, it breaks my dependency on hdf5-sys. Is there a way to adjust for this? I'm reasonably new to rust and don't have a great grasp on the way the cargo works.

TrippLamb avatar Oct 24 '23 18:10 TrippLamb

@trippalamb Add another line with hdf5-sys and the same contents

mulimoen avatar Oct 24 '23 18:10 mulimoen

That did indeed seem to fix it. I appreciate it.

TrippLamb avatar Oct 24 '23 18:10 TrippLamb

I was able to solve my problem by just unset-ing my HDF5_DIR variable. I have it in my .zshrc since I need it so often, but this time it was causing problems I guess.

nleroy917 avatar Oct 24 '23 18:10 nleroy917