[Gdal-dev] hdf4, hdf-eos and gcc 3.4 issues

Norman Vine nhv at cape.com
Wed Jun 23 07:05:52 EDT 2004


Vincent Schut writes:
> 
> GDAL-cvs doesn't build for me since a couple of days, and I think the 
> combination of using hdf-eos and my compiler: gcc3.4, could be the cause.
> 
> So far I found out:
> 
> - the include of HdfEosDef.h from hdf4dataset.cpp doesn't work, because gcc 
> can't find it. After changing the compile line to include '-I./hdf-eos', this 
> was solved. I however don't know the appropriate place to add this 
> (GNUmakefile?).
> 
> - gcc complains about not finding includes if they are between <> when they 
> should be between "". This is the case for <ease.h> from HdfEosDef.h, and for 
> <HDFEOSVersion.h> from EHapi.c.
> 
> - after these changes, I get the following error which is beyond my knowledge:
> 
> vincent at timo hdf-eos $ make
...
> HDFEOSVersion.h:16:1: pasting ""@(#)## HDFEOS Version: "" and "HDFEOSVERSION1" 
> does not give a valid preprocessing token
> HDFEOSVersion.h:17:1: pasting ""@(#)## Build date: "" and "__DATE__" does not 
> give a valid preprocessing token
> HDFEOSVersion.h:17:1: pasting "__DATE__" and "" @ "" does not give a valid 
> preprocessing token
> HDFEOSVersion.h:17:1: pasting "" @ "" and "__TIME__" does not give a valid 
> preprocessing token


I needed to make the following change to compile this with Cygwin

$ cvs diff HDFEOSVersion.h
Index: HDFEOSVersion.h
===================================================================
RCS file: /cvs/gdal/frmts/hdf4/hdf-eos/HDFEOSVersion.h,v
retrieving revision 1.1
diff -r1.1 HDFEOSVersion.h
7c7
< #ifdef LINUX
---
> #if defined(LINUX) || defined(__CYGWIN__)


======= hack attack =======

< WARNING --- following only for those *very* comfortable 
   with hacking configuration scripts and unix install proceedures >

BTW I used a slightly modified hdf4.2r0 distribution and have managed 
to get both hdf and netcdf working :-)

I don't have a set of changes but in essence I used the LINUX configuration
< copied hdf4.2r0/config/mh-linux to hdf42.4r0/config/mh-cygwin >

I also hardwired mfhdf to use its renamed version of netcdf functions 
by modifying hdf4.2.r0/mfhdf/libsrc/libsrc/hdf2netcdf.h

$ diff  hdf2netcdf.bak hdf2netcdf.h
7a8,11
> #ifdef __CYGWIN__
> #define HAVE_NETCDF 1
> #endif
>

I also needed to add  -lrpclib to the link process
< this may not be needed for all systems >

So far using hdf4.2r0 seems to work well but I haven't done
any rigorous testing

You will also need to reinstall netcdf after installing this version
as it will overwrite any existing netcdf installation

=======================

HTH

Norman




More information about the Gdal-dev mailing list