pgcc/pgf90 and HDF5 on mac os x

Hello ,
I’m having a hard time compiling HDF5 library (I/O library) on a mac os x computer.

Here is the error the beginning of the error message:

pgcc -I. -I…/…/src -I…/…/src -c H5f90kit.c -o H5f90kit.o
PGC-S-0040-Illegal use of symbol, _fcd (./H5f90proto.h: 19)
PGC-W-0156-Type not specified, ‘int’ assumed (./H5f90proto.h: 19)
PGC-S-0040-Illegal use of symbol, int_f (./H5f90proto.h: 62)
PGC-W-0156-Type not specified, ‘int’ assumed (./H5f90proto.h: 62)

When I look at the H5f90proto.h file
lines 19 and 62 look like this

19: H5_FCDLL char * HD5f2cstring (_fcd fdesc, size_t len);
62: H5_FCDLL int_f nh5fcreate_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id);

Any ideas ?

Hi neldorth,

It looks like the file fortran/src/H5f90i.h needs to be updated to include configuration options for OSX and PGI. Adding the following seemed to do it:

/* MAC APPLE definitions with PGI compiler*/
#if defined(__osx86) && defined(__PGI)
typedef char              *_fcd;
typedef long long         haddr_t_f;
typedef long long         hsize_t_f;
typedef long long         hssize_t_f;
typedef int               size_t_f;
typedef int               int_f;
typedef int               hid_t_f;
typedef float             real_f;
#define FNAME_POST_UNDERSCORE
#define _fcdtocp(desc) (desc)

#endif /*OSX PGI*/

I encountered another error with fortran/src/H5fortran_types.f90 where the configure script is suppose to add some datatype information but instead left it blank. To work around this problem I updated the file to use the following which I generated on Linux.

         INTEGER, PARAMETER :: R_LARGE = 18
         INTEGER, PARAMETER :: R_INTEGER = 9
         INTEGER, PARAMETER :: HADDR_T  = SELECTED_INT_KIND(R_LARGE)
         INTEGER, PARAMETER :: HSIZE_T  = SELECTED_INT_KIND(R_LARGE)
         INTEGER, PARAMETER :: HSSIZE_T = SELECTED_INT_KIND(R_LARGE)
         INTEGER, PARAMETER :: HID_T    = SELECTED_INT_KIND(R_INTEGER)
         INTEGER, PARAMETER :: SIZE_T   = SELECTED_INT_KIND(R_INTEGER)

         !
         ! Some HDF5 FORTARN90 default values ( here for now 8/5/99 EIP )
         !

         INTEGER(SIZE_T), PARAMETER :: OBJECT_NAMELEN_DEFAULT_F = -1

With these changes, it built for me on 64-bit OSX and all the test codes passed. However, I did not test it with real application. Please let us know how it goes.

  • Mat

Thanks i’ll try that right away. Just wanted to point out that the 1.8 beta for HDF seems to have corrected all this issues. Configure , compilation go smoothly. I’m currently testing on a real App.
I’ll try you modifications too since i prefer to keep 1.6.5 for now.