Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
trippalamb opened this issue Sep 7, 2023 · 19 comments
Open

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

trippalamb opened this issue Sep 7, 2023 · 19 comments

Comments

@trippalamb
Copy link

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

@mulimoen
Copy link
Collaborator

mulimoen commented Sep 7, 2023

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

@TrippLamb
Copy link

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

@mulimoen
Copy link
Collaborator

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

@trippalamb
Copy link
Author

It is the same as this issue title "1.14.2"

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

@loenard97
Copy link

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"

@mulimoen
Copy link
Collaborator

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

@loenard97
Copy link

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.

@mulimoen
Copy link
Collaborator

@aldanor Maybe we should release a new version soon?

@nleroy917
Copy link

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.

@loenard97
Copy link

@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" }

@nleroy917
Copy link

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...

@mulimoen
Copy link
Collaborator

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

@nleroy917
Copy link

😱 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 😅

@mulimoen
Copy link
Collaborator

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

@nleroy917
Copy link

nleroy917 commented Oct 23, 2023

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"]}

@TrippLamb
Copy link

@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.

@mulimoen
Copy link
Collaborator

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

@TrippLamb
Copy link

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

@nleroy917
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants