Opened 11 years ago

Closed 11 years ago

#2609 closed defect (fixed)

hdf4 and hdf4-eos drivers will not build

Reported by: arb Owned by: warmerdam
Priority: highest Milestone: 1.5.4
Component: GDAL_Raster Version: unspecified
Severity: blocker Keywords: hdf4
Cc: dron

Description

The hdf4 and hdf-eos drivers do not build. Tested against hdf4.2r3 (the latest).

Some fixes in trunk have not yet made it into 1.5.3, eg. UNKNOWN changed to H4ST_UNKNOWN

Some fixes are still required, i.e. MAX_VAR_DIMS should be H4_MAX_VAR_DIMS, MAX_NC_DIMS should be H4_MAX_NC_DIMS, MAX_NC_NAME should be H4_MAX_NC_NAME.

Attachments (1)

hdf4.patch (11.2 KB) - added by Even Rouault 11 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by Even Rouault

In fact, it depends on how hdf4.2r3 has been built.

If hdf4.2r3 is built after a ./configure --prefix=/path/to/installation-dir, then the HDF4 driver builds fine.

But if hdf4.2r3 is built after a ./configure --disable-netcdf --prefix=/path/to/installation-dir, the above changes are necessary. Note : UNKNOWN is already renamed in H4ST_UNKNOWN in trunk

comment:2 Changed 11 years ago by Even Rouault

If we change MAX_VAR_DIMS -> H4_MAX_VAR_DIMS, etc. , it builds with a hdf4.2r3 built in both --enable-netcdf and --disable-netcdf mode. However, the H4_ macros don't exist in older hdf4 releases, for example they don't exist in 4.1r4 which is installed with my ubuntu 8.04. So there's a need for some conditionnal test on the hdf4 library version if we want to support building on both versions.

comment:3 Changed 11 years ago by arb

Or just do this after the hdf includes ?

#ifndef H4_MAX_VAR_DIMS
#define H4_MAX_VAR_DIMS MAX_VAR_DIMS
#endif

comment:4 Changed 11 years ago by Even Rouault

Cc: dron added
Component: defaultGDAL_Raster
Keywords: hdf4 added

Yes, indeed. I'm attaching a patch against trunk that enables to build the HDF4 driver against hdf4.1r4 and hdf4.2r3. I've added a hdf4compat.h to define the H4_xxx macros if necessary.

CC'ing Andrey to let him apply if appropriate.

Changed 11 years ago by Even Rouault

Attachment: hdf4.patch added

comment:5 Changed 11 years ago by dron

Resolution: fixed
Status: newclosed

I have applied suggested fixes, see r15522. Should it go in 1.5 too?

comment:6 Changed 11 years ago by Even Rouault

Resolution: fixed
Status: closedreopened

I reopen since hdf4compat.h in frmts/hdf4 has been forgotten to be commited.

As for commiting this to 1.5, it seems that a few people on the mailing list seem to be interessed by that. But it looks like some other changes made in trunk should be applied too, like the UNKNOWN -> H4ST_UNKNOWN

comment:7 Changed 11 years ago by dron

r15524 adds forgotten hdf4compat.h.

comment:8 Changed 11 years ago by Even Rouault

Maybe worth backporting those changes in 1.5 branch, likely for 1.5.4 now.

comment:9 Changed 11 years ago by Even Rouault

Milestone: 1.5.4
Resolution: fixed
Status: reopenedclosed

Needed fixes backported in branches/1.5 in r15557

Note: See TracTickets for help on using tickets.