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

/runtimes/osx-x64/native/ binaries not found when calling H5T #20

Open
davidmeijer opened this issue Jul 19, 2021 · 0 comments
Open

/runtimes/osx-x64/native/ binaries not found when calling H5T #20

davidmeijer opened this issue Jul 19, 2021 · 0 comments

Comments

@davidmeijer
Copy link

I am using HDF.PInvoke.1.10 with F# on OS X. However, H5F.create() results in the following exception being thrown:

Unhandled exception. System.TypeInitializationException: The type initializer for 'HDF.PInvoke.H5T' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'HDF.PInvoke.H5DLLImporter' threw an exception.
 ---> System.IO.FileNotFoundException: hdf5
   at HDF.PInvoke.H5MacDllImporter..ctor(String libName) in /home/appveyor/projects/hdf-pinvoke-1-10/src/HDF.PInvoke.1.10/H5DLLImporter.cs:line 169
   at HDF.PInvoke.H5DLLImporter..cctor() in /home/appveyor/projects/hdf-pinvoke-1-10/src/HDF.PInvoke.1.10/H5DLLImporter.cs:line 42
   --- End of inner exception stack trace ---
   at HDF.PInvoke.H5T..cctor() in /home/appveyor/projects/hdf-pinvoke-1-10/submodules/HDF.PInvoke/HDF5/H5Tglobals.cs:line 38
   --- End of inner exception stack trace ---
   at [email protected](Int64 id, String name, String[] data) in /Users/davidmeijer/Dropbox/My Mac (Davids-Mac-mini.local)/Downloads/h5/Program.fs:line 11
   at Program.run() in /Users/davidmeijer/Dropbox/My Mac (Davids-Mac-mini.local)/Downloads/h5/Program.fs:line 18
   at <StartupCode$h5>.$Program.main@() in /Users/davidmeijer/Dropbox/My Mac (Davids-Mac-mini.local)/Downloads/h5/Program.fs:line 23

The following code sample in a F# project reproduces the previously shown error:

module Program

open HDF.PInvoke

type IHdf5ReaderWriter =
    abstract WriteStrings: int64 * string * string [] -> unit

let Hdf5AttributeRW () =
    { new IHdf5ReaderWriter with
        member _.WriteStrings (id : int64, name : string, data : string []) =
            let dataType = H5T.create(H5T.class_t.STRING, H5T.VARIABLE)
            ()
    }
    
let run () =
    let fileId = H5F.create("./test_hdf5.h5", H5F.ACC_TRUNC)
    let rw = Hdf5AttributeRW()
    rw.WriteStrings(fileId, "version", [| "0.1.0" |])
    H5F.close(fileId) |> ignore    
    0

[<EntryPoint>]
run() |> printfn "%A"

I managed to find a work-around by copying the binaries in /runtimes/osx-x64/native/ directly to the bin/Debug/net5.0 folder. I'm not sure, but I think the exception is caused by the H5MacDllImporter not being able to properly find those files.

I was hoping somebody could shed some light on this issue for me. Thanks!

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

1 participant