Wiki

Clone wiki

h5mma / Compiling h5mma

Mac OSX

First install the required HDF5 library. If you're using Homebrew:

#!bash

brew install hdf5
or MacPorts:
#!bash

sudo port install hdf5-18
or Fink:
#!bash
sudo apt-get install hdf5-18 szip

Then compile h5mma:

#!bash

  cd $HOME/Library/Mathematica/Applications
  git clone https://bitbucket.org/simulationtools/h5mma
  cd h5mma
  make

Ubuntu

The version of HDF5 provided with Ubuntu does not currently work due to a known bug in the package. This will be fixed in the future. Until then, install HDF5 manually by downloading the source package, extracting the tarball and then in the extracted directory running:

#!bash

./configure --prefix=/usr/local && make && sudo make install
Now, get a copy of the h5mma repository:
#!bash

  cd $HOME/Library/Mathematica/Applications
  git clone https://bitbucket.org/simulationtools/h5mma
  cd h5mma
then copy the 'make.defs.example' file to 'make.defs' and edit it so that it has the following:
#!Makefile

HDF5DIR    = /usr/local
MLINKDIR   = /usr/local/Wolfram/Mathematica/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux/CompilerAdditions
You may need to adjust the MLINKDIR for your system. In particular, if your system is 64-bit, change 'Linux' to 'Linux-x86-64'.

Finally, build h5mma:

#!bash

make

Windows

The following instructions are for compiling with Windows 8.

  • Install Visual C++ 2012 Express fow Windows Desktop
  • Run Windows Update
  • Install HDF5 using the instructions provided.
  • Install Mathematica 10.0.1
  • Install git
  • Get a copy of the h5mma source code:
    #!bash
    
    cd %HOMEPATH%\AppData\Roaming\Mathematica\Applications
    git clone https://bitbucket.org/simulationtools/h5mma.git
    
  • Generate h5mmatm.cc file:
    #!bash
    
    cd h5mma
    "c:\Program Files\Wolfram Research\Mathematica\10.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\bin\mprep.exe" h5mma.tm -o h5mmatm.cc
    
  • Create Visual Studio Windows Application project from existing files and point it to the h5mma directory
  • In project properties, add HDF5 and Mathematica include and lib paths
  • In project properties, add additoinal dependencies: ml32i4m.lib;szip.lib;zlib.lib;hdf5.lib; (for 64-bit, use ml64i4m.lib instead)
  • In project properties, add post-build rules (if compiling for 64-bit, change Windows to Windows-x86-64)
    #!bash
    
    if not exist "$(SolutionDir)\Windows" mkdir "$(SolutionDir)\Windows"
    copy /Y "$(SolutionDir)$(Configuration)\h5mma.exe" "$(SolutionDir)\Windows\h5mma"
    
  • Set build to Release and to Win32 or x64, as appropriate.
  • Build project

Other

Create the file 'make.defs' using the template provided in 'make.defs.example'. Edit the paths in this file to point to the appropriate locations on your machine:

#!

HDF5DIR:    This should be the directory containing lib/libhdf5*.
SZIPDIR:    This should be the directory containing lib/libsz*.
MLINKDIR:   This should be the directory containing mcc and mprep.
Once these paths have been set, build h5mma:
#!bash

make

Updated