Code Monkey home page Code Monkey logo

hdf.pinvoke.1.10's People

Contributors

achilles1515 avatar gheber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hdf.pinvoke.1.10's Issues

Unhandled exception. System.TypeInitializationException: The type initializer for 'HDF.PInvoke.H5T' threw an exception.

Hello,

I am trying to use this library to read and write data from HDF5 files. I am able to read data from a HDF5 file but when I try to save a HDF5 file I get this error:

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: libhdf5.dylib
   at HDF.PInvoke.H5MacDllImporter..ctor(String libName) in /home/appveyor/projects/hdf-pinvoke-1-10/src/HDF.PInvoke.1.10/H5DLLImporter.cs:line 213
   at HDF.PInvoke.H5DLLImporter..cctor() in /home/appveyor/projects/hdf-pinvoke-1-10/src/HDF.PInvoke.1.10/H5DLLImporter.cs:line 70
   --- 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 HDF.PInvoke.H5T.get_NATIVE_INT32() in /home/appveyor/projects/hdf-pinvoke-1-10/submodules/HDF.PInvoke/HDF5/H5Tglobals.cs:line 332
   at HNSW.Net.Demo.Hdf5Utils.GetDatatype(Type type) in /Users/siddjain/github/hnsw-sharp-demo/Hdf5Utils.cs:line 153
   at HNSW.Net.Demo.Hdf5Utils.WriteDataset[T](Int64 fileId, String dataset, T[] data, UInt64[] dimensions) in /Users/siddjain/github/hnsw-sharp-demo/Hdf5Utils.cs:line 193
   at HNSW.Net.Demo.Program.Main() in /Users/siddjain/github/hnsw-sharp-demo/Program.cs:line 87

Its strange because while reading from HDF5 file I don't get any System.IO.FileNotFoundException: libhdf5.dylib exception.

The full code for the Hdf5Utils.cs class in the stacktrace can be seen here: https://github.com/siddhsql/hnsw-sharp-demo/blob/main/Hdf5Utils.cs

In addition I set DYLD_LIBRARY_PATH equal to the location where the libhdf5.dylib can be found. I am running on Mac os.

$ ls -al /opt/homebrew/lib/libhdf5.dylib
lrwxr-xr-x@ 1 siddjain  admin  39 Jul 10 17:34 /opt/homebrew/lib/libhdf5.dylib -> ../Cellar/hdf5/1.14.1/lib/libhdf5.dylib

I am using below version of the library:

<PackageReference Include="HDF.PInvoke.1.10" Version="1.10.612" />

Below are actual screenshots if it helps:

Pasted Graphic 1 Pasted Graphic 2

Sign assembly.

Currently, the assembly is not signed with a strong name because during build, the following settings have no effect:

<!-- Sign assembly -->
  <PropertyGroup>
    <SignAssembly>true</SignAssembly>
    <DelaySign>false</DelaySign>
    <PublicSign>true</PublicSign>
    <AssemblyOriginatorKeyFile>$(Root)submodules/HDF.PInvoke/HDF.PInvoke.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup> 

Signing should be reenabled once it is clear how to accomplish this in a portable way.

Targeting ARM64 platforms

We are looking to target a specific ARM64 platform(working to cross compile the native HDF libraries). Is there a recommended way to add support for another platform?

Seems like it should be strait forward by adding another architecture specific folder. Just wondering if there is anything else that might need to be changed besides adding the appropriate native libraries.

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

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!

Test on Linux failed because native HDF5 lib could not be found.

As soon as a Symbol is accessed (e.g. H5T.NATIVE_DOUBLE), the FileNotFoundError is thrown.

Reason:

var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

returns the string <Unknown> and so the file path is not built correctly.

No solution known yet. A workaround is to copy the native lib into the current directory.

More info: https://stackoverflow.com/questions/40477734/executing-assembly-location-is-unknown

question: register for logs

Is there a way to register for the console output of errors and such? I would like to get all traces and outputs in my logging framework

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.