Before installing HDF5 for Lua, obtain the HDF5 1.8 library if not shipped with your distribution.

GCC 4.5 or later is required to compile FFI bindings for the HDF5 library.

For parallel HDF5, you need an MPI C compiler and MPI for Lua.


HDF5 for Lua is available from a git repository:

git clone

In the repository, checkout the latest release version:

git checkout 2.0.0

If you have GnuPG, verify that the tag is signed by the following key:

git tag -v 2.0.0
Primary key fingerprint: 2997 6EC2 2BD1 EBBC CC77  F3A6 183B D5ED 3527 8611
     Subkey fingerprint: 983B F9D0 F02A 6014 0CEC  529F 767E 12A8 C92A 31CB

If the HDF5 header files are in a nonstandard include path, set CPATH:

export CPATH=/usr/include/hdf5/mpich

If the HDF5 library is in a nonstandard library path, set LIBRARY_PATH:

export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/hdf5/mpich

If LuaJIT is not installed system-wide, set PKG_CONFIG_PATH:

export PKG_CONFIG_PATH=/opt/luajit-2.0.3/lib/pkgconfig

Compile the FFI bindings for the HDF5 library and run the test suite:


To override the default GCC C compiler gcc, set CC:

make CC=gcc-4.7

For parallel HDF5, to override the default MPI C compiler mpicc, set CPP:

make CPP=mpicc.mpich

To test parallel HDF5 using the MPI-IO driver:

make MPIEXEC="mpirun -np 8"


HDF5 for Lua is available from LuaRocks:

luarocks install --local hdf5

You may wish to remove older versions before installing:

luarocks remove --local hdf5

To use the module, set the Lua module path in your shell's startup file:

eval `luarocks path`

If the LuaRocks mirror is not available, install from the git repository above:

luarocks install --local rockspec/hdf5-2.0.0-1.rockspec

To install the module directly from the git source, use:

luarocks make --local rockspec/hdf5-2.0.0-1.rockspec

In this case you must manually git checkout the corresponding version beforehand.