Build HDF5 Filter Plugins on Linux Using MATLAB HDF5 Shared Library or GNU Export Map

18 views (last 30 days)
How do I build HDF5 Filter Plugins on Linux Using MATLAB HDF5 Shared Library or GNU Export Map?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Sep 2021
Edited: MathWorks Support Team on 14 Sep 2021
Starting in R2021b, if you are working with HDF5 Dynamically Loaded Filters on Linux and if your filter plugin contains callbacks to the core HDF5 library (requires header hdf5.h), then you need to rebuild your filter plugin with the symbol-versioned HDF5 1.10.7.
To rebuild your filter plugin on a standard Linux configure/make/make install build commands, use one of the options below. If you are using CMake, then make the analogous changes to the header and library paths.
Option 1:
Build the plugin using the HDF5 version 1.10.7 shared library libhdf5.so.103.3.0 in /matlab/bin/glnxa64.
a. Obtain the HDF5 1.10.7 header files from The HDF Group at https://www.hdfgroup.org/solutions/hdf5/ . Use this for PATH_TO_HDF5_INCLUDEDIR.
b. Use /matlab/bin/glnxa64 for PATH_TO_HDF5_LIBDIR.
c. When invoking configure, specify paths to the above INCLUDEDIR and LIBDIR. Additional paths to the filter algorithm remain the same:
./configure --with-hdf5=PATH_TO_HDF5_INCLUDEDIR,PATH_TO_HDF5_LIBDIR
d. Run make and make install as usual.
Option 2:
Build HDF5 1.10.7 from source using the GNU Export Map to add symbol-versioning to the resultant binary.
a. Download the HDF5 1.10.7 Export Map text file hdf5_linux_exported_symbol.map attached to this answer.
b. When building HDF5 1.10.7 from source, set LDFLAGS to point to the map:
LDFLAGS += -Wl,--version-script=hdf5_linux_exported_symbol.map
c. When building the filter plugin, specify the LIBRDIR path as the resultant 1.10.7 shared library path from step b.
With either option, to ensure the MATLAB HDF5 version string is embedded in any callbacks to HDF5, you can check the dynamic symbol table in your plugin shared library using readelf or objdump. For example, if the plugin has a call to H5Pcreate, then the symbol entry should show the MWHDF5 symbol decoration.  See the following examples:
readelf -Ws <plugin.so>
H5Pcreate@@MWHDF5 0000000000000000 0 FUNC GLOBAL DEFAULT UND H5Pcreate@MWHDF5
objdump -C -T <plugin.so>
0000000000000000 DF *UND* 0000000000000000 MWHDF5 H5Pcreate

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!