Compiling your HDF5 Applications


We provide the h5cc (C), h5c++ (C++) and h5fc (F90) utilities for compiling applications. These utilities come with the HDF5 source code and binary distributions (include files, libraries, and utilities) for the platforms we support. The h5c++ and h5fc utilities are ONLY present if the library was built with C++ and Fortran. (See the end of this page for obtaining these scripts.)

After you have installed your binaries in their final destination, you can use the scripts (h5cc, h5fc, h5c++) to compile. However, you must first:

  1. Run ./h5redeploy to change site specific paths in the scripts.
  2. Edit each script and update the paths for the external libraries in LDFLAGS and CPPFLAGS (ZLIB, SZIP).
You may also need to change other variables in the scripts, depending on how things are set up on your system. Here are some of the variables to check:
  prefix      - Path to the HDF5 top level installation directory
  CCBASE      - Name of the alternative C compiler
  CLINKERBASE - Name of the alternative linker
  LIBS        - Libraries your application will link with
For information on settings used to build the HDF5 libraries, please refer to:
    ./lib/libhdf5.settings 
    ./lib/libhdf5_fortran.settings (if Fortran enabled)  
    ./lib/libhdf5_cpp.settings (if C++ enabled)

HDF5 Libraries Used by Scripts

If you run a compile script with the -show option (for eg., h5cc -show), it will list the libraries that are linked in with the binaries. Depending on how the HDF5 library was built, the binaries may include the following libraries:
    libhdf5.a         - HDF5 C Library
    libhdf5_cpp.a     - HDF5 C++ APIs  (if included)
    libhdf5_fortran.a - HDF5 Fortran Library (if included)
    libhdf5_hl.a      - HDF5 High Level APIs (if included)
You may also see shared versions of these libraries (ending in so*).

The pre-compiled binaries, in particular, are built (if at all possible) with these libraries, as well as with SZIP and ZLIB. If using SZIP, be sure to add the path to the SZIP shared library to LD_LIBRARY_PATH. If using the shared HDF5 libraries you will also need to add the path to the HDF5 shared library to the LD_LIBRARY_PATH variable.

Obtaining the Compile Scripts

To obtain h5cc/h5fc/h5c++ either separately or as part of the binary distributions, see:
    /HDF5/release/obtain5.html 
This page can also be found in the table on the left of the HDF5 home page under "Obtain Latest".

Utilities such as the compile scripts are included in the bin/ directory of the binaries.


Last Modified: February 19, 2007