Clear Filters
Clear Filters

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

10 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Aug 2024
Edited: MathWorks Support Team on 28 Aug 2024
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
-
Note: In order to build an HDF5 Filter Plugin from scratch, you need to link not only to the HDF5 library but also to the associated compression algorithm library. For example, when building the HDF5 BZIP2 Filter Plugin in Linux, you need to tell configure the location of the bzip2 compression algorithm binary libbz2.so.*. On Linux, libbz2.so.* is typically located in /usr/lib/.
Here is the example from the HDF5 BZIP2-plugin README.txt (also discussed in HDF5 Dynamically Loaded Filters on p.17) which indicates that both the location of the HDF5 library and the location of libbz2.so.* need to be passed to configure:
Building this filter/example requires knowledge of the hdf5 and the bzip2 installation. For autotools configure, you must supply these using:
--with-hdf5 and --with-bz2lib.
Example (in the build folder):
./configure --with-hdf5=/temp/hdf5 --with-bz2lib=/temp/bz2

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!