Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
diana:windows:building:hdf [2010-02-16 17:52:47] dages |
diana:windows:building:hdf [2022-05-31 09:29:31] (current) |
There are binaries available, and they're probably fine, but the headers are not, because HDF4 / HDF5 install different headers depending on which compiler they were built with (which in itself is a bug). Luckily, building them from source is fairly easy. | There are binaries available, and they're probably fine, but the headers are not, because HDF4 / HDF5 install different headers depending on which compiler they were built with (which in itself is a bug). Luckily, building them from source is fairly easy. |
| |
Yeah, right. Actually, HDF4 is a nightmare. | Yeah, right. Actually, [[windows:building:hdf4|HDF4]] is a nightmare, so we've left it out. |
| |
===== NetCDF ===== | ===== NetCDF ===== |
$ LDFLAGS=-L/c/met.no/lib CPPFLAGS=-I/c/met.no/include ./configure --prefix=/c/met.no --disable-f90 --disable-examples | $ LDFLAGS=-L/c/met.no/lib CPPFLAGS=-I/c/met.no/include ./configure --prefix=/c/met.no --disable-f90 --disable-examples |
$ make all install | $ make all install |
| $ cp COPYRIGHT /c/met.no/copyright/netcdf.txt |
| |
<del>Note the ''%%--enable-shared%%'' part; you can leave out ''%%--disable-f90%%'' and ''%%--disable-examples%%'' if you want, but keep ''%%--enable-shared%%''.</del> | <del>Note the ''%%--enable-shared%%'' part; you can leave out ''%%--disable-f90%%'' and ''%%--disable-examples%%'' if you want, but keep ''%%--enable-shared%%''.</del> |
| |
===== HDF4 ===== | |
| |
First, get the latest source (currently 4.2r4) from http://www.hdfgroup.org/release4/obtain.html and extract it in a convenient place. | |
| |
HDF4's autoconf infrastructure is a weird mix of too-old and too-new. Open ''configure.ac'', look for "Libtool initialization" (around line 660) and replace the following two lines | |
| |
LT_INIT(dlopen) | |
LT_OUTPUT | |
| |
with these: | |
| |
AC_LIBTOOL_DLOPEN | |
AM_PROG_LIBTOOL | |
| |
Next, there is a spot in ''configure.ac'' that checks which OS you're running on and bails if it doesn't recognize it... which is stupid, because it controls code that is only used *only* if you want to use HDF4's own version of NetCDF, which we don't. We can work around this by changing ''cygwin'' to ''mingw32'' on line 695. It's wrong, but it doesn't matter, because the result is never used (see below). | |
| |
Finally, MinGW doesn't have the Sun RPC library, so there are some missing ''SOURCES'', ''INCLUDES'' and ''LDADD'' lines in several Makefiles: | |
| |
$ echo 'libxdr_la_SOURCES += byteordr.c' >>mfhdf/xdr/Makefile.am | |
$ echo 'INCLUDES += -I$(top_srcdir)/mfhdf/xdr' >>mfhdf/libsrc/Makefile.am | |
$ echo 'INCLUDES += -I$(top_srcdir)/mfhdf/xdr' >>mfhdf/ncdump/Makefile.am | |
$ echo 'ncdump_LDADD += ../xdr/libxdr.la'>>mfhdf/ncdump/Makefile.am | |
| |
**XXX** still doesn't work | |
| |
Then regenerate everything: | |
| |
$ aclocal | |
$ libtoolize --copy --force | |
$ autoheader | |
$ automake --add-missing --copy --foreign | |
$ autoconf | |
| |
<del>**XXX** automake warns about ''F77LINK'', check if that requires fixing.</del> harmless since we don't build the Fortran interface | |
| |
Finally, configure, build and install: | |
| |
$ LDFLAGS=-L/c/met.no/lib CPPFLAGS="-I/c/met.no/include -DNO_SYS_XDR_INC" ./configure --prefix=/c/met.no --disable-fortran --disable-netcdf | |
$ make all install | |
| |
The ''-DNO_SYS_XDR_INC'' part fixes more xdr-related breakage. | |
| |
You //must// specify ''%%--disable-netcdf%%'', otherwise HDF4 will clobber NetCDF's header files! | |
| |
**XXX** I'm worried that the xdr stuff may cause more trouble down the line | |
| |
===== HDF5 ===== | ===== HDF5 ===== |
$ LDFLAGS=-L/c/met.no/lib CPPFLAGS=-I/c/met.no/include ./configure --prefix=/c/met.no --enable-cxx | $ LDFLAGS=-L/c/met.no/lib CPPFLAGS=-I/c/met.no/include ./configure --prefix=/c/met.no --enable-cxx |
$ make all install | $ make all install |
| $ cp COPYING /c/met.no/copyright/hdf5.txt |
| |
**TODO** fix large file support! | **TODO** fix large file support! |