Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The following worked on my system:</p> <ol> <li><p>Install hdf5 version 1.8.4 (you've already done this: I installed the source and compiled to ensure it is compatible with my system, that I get gcc versions and that I get the static libraries - e.g. the binaries offered for my system are <code>icc</code> specific).</p></li> <li><p>Make a target file. You already have your own file. I used the simple <code>h5_crtfile.c</code> from <a href="http://www.hdfgroup.org/HDF5/Tutor/examples/C/h5_crtfile.c" rel="noreferrer">here</a> (a good idea to start with this simple file first a look for warnings). I changed <code>main</code> to <code>mexFunction</code> with the usual args and included <code>mex.h</code>.</p></li> <li><p>Specify the <em>static</em> 1.8.4 library you want to load explicitly (the full path with no -L for it necessary) and don't include <code>-lhdf5</code> in the <code>LDFLAGS</code>. Include a <code>-t</code> option so you can ensure that there is no dynamic hdf5 library being loaded. You also need <code>-lz</code>, with <code>zlib</code> installed. For darwin we also need a <code>-bundle</code> in <code>LDFLAGS</code>:</p> <pre><code>mex CFLAGS='-I/usr/local/hdf5/include' LDFLAGS='-t /usr/local/hdf5/lib/libhdf5.a -lz -bundle' h5_crtfile.c -v </code></pre> <p>For linux, you need an equivalent position-independent call, e.g. <code>fPIC</code> and maybe <code>-shared</code>, but I don't have a linux system with a matlab license, so I can't check:</p> <pre><code>mex CFLAGS='-fPIC -I/usr/local/hdf5/include' LDFLAGS='-t /usr/local/hdf5/lib/libhdf5.a -lz -shared' h5_crtfile.c -v </code></pre></li> <li><p>Run the <code>h5_crtfile</code> mex file. This runs without problems on my machine. It just does a H5Fcreate and H5Fclose to create "file.h5" in the current directory, and when I call <code>file file.h5</code> I get <code>file.h5: Hierarchical Data Format (version 5) data</code>.</p></li> </ol> <p>Note that if I include a <code>-lhdf5</code> above in step 3, then matlab aborts when I try to run the executable (because it then uses matlab's dynamic libraries which for me are version 1.6.5), so this is definitely solving the problem on my system. </p> <p>Thanks for the question. My solution above is definitely much easier for me than what I was doing before. Hopefully the above works for you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload