hdf images hdf images

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.

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

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

The h5cc/h5fc/h5c++ scripts are in the bin/ directory of the binary distribution of HDF5. See the Obtain The Latest HDF5 Software page for obtaining HDF5.


- - Last modified:May 16th 2011