Skip to content

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

@davidmeijer

Description

@davidmeijer

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 Program.Hdf5AttributeRW@9.Program.IHdf5ReaderWriter.WriteStrings(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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions