Version 2 (modified by 12 years ago) ( diff ) | ,
---|
HDF5 Compiler Problems
Symptom: HDF5 programs written in C return 'undefined reference to `function_name
' messages for all HDF5 functions when compiled on GNU or Intel compilers.
Problem: HDF5 compilation requires a pretty complicated tangle of linking options. They were all sorted out in Fortran on AstroBEAR a long time ago, but starting a new project using gcc
or ifc
is a tricky prospect.
Affects: Anyone trying to compile a C module that uses HDF5. The problem may even extend to Fortran users attempting to compile new HDF5 projects independent of the AstroBEAR makefile framework.
Solution: Most newer HDF5 distributions (verifiably as far back as 1.6.2) come with the h5cc
compilation script. This essentially wraps currently-installed compilers with the required inclusions and linking options to compile an HDF5 project in C. The script can be found in the HDF_DIR/bin/
directory, and can be incorporated into a make file (replacing gcc
or icc
under the COMPILER
option) or used in the command line using gcc
-like syntax:
/usr/local/hdf5/bin/h5cc foo.c -o foo