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

22 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 9 Dec 2021
Edited: MathWorks Support Team on 14 Mar 2022
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 for MATLAB R2021b or HDF5 1.10.8 for MATLAB R2022a and further.
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 (MATLAB R2021b) or 1.10.8 (MATLAB R2022a and further) shared library libhdf5.so.x.x.x in /matlab/bin/glnxa64.
a. Obtain the HDF5 1.10.x 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 (MATLAB R2021b) or 1.10.8 (MATLAB R2022a and further) from source using the GNU Export Map to add symbol-versioning to the resultant binary.
a. Download the HDF5 1.10.x Export Map text file hdf5_1_10_7_linux_exported_symbol.map or hdf5_1_10_8_linux_exported_symbol.map attached to this answer.
b. When building HDF5 1.10.x from source, set LDFLAGS to point to the map:
LDFLAGS += -Wl,--version-script=hdf5_1_10_7_linux_exported_symbol.map
or
LDFLAGS += -Wl,--version-script=hdf5_1_10_8_linux_exported_symbol.map
c. When building the filter plugin, specify the LIBRDIR path as the resultant 1.10.x 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!