This is an old revision of the document!
Building NetCDF, HDF4 and HDF5 on Windows
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.
TODO: Figure out the exact relationship between these three. Apparently, HDF4 wants NetCDF, and NetCDF wants HDF5…
NetCDF
First, get the latest source (currently 4.0.1) from http://www.unidata.ucar.edu/software/netcdf/ and extract it in a convenient place, then configure, build and install:
$ ./configure --prefix=/opt/netcdf --enable-shared --disable-f90 --disable-examples $ make LDFLAGS=-no-undefined all install
Note the –enable-shared
part; you can leave out –disable-f90
and –disable-examples
if you want, but keep –enable-shared
.
TODO: check configure options
HDF4
First, get the latest source (currently 4.2r4) from http://www.hdfgroup.org/release4/obtain.html and extract it in a convenient place, then configure, build and install:
$ ./configure --prefix=/opt/hdf $ make $ make install
TODO: check configure options
HDF5
First, get the latest source (currently 1.8.3) from http://www.hdfgroup.org/HDF5/release/obtain5.html and extract it in a convenient place.
In HDF5 1.8.3, there are three issues we need to address before we can build the library.
note: the first two issues have been reported to the HDF Group and will be fixed in the next release.
The first is a bug in perform/sio_engine.c
: on line 376, replace mkdir
with HDmkdir
.
The second is that the test scripts use Winsock (ws2_32.lib
), but don't link against it. This can be fixed by setting the LIBS
environment variable to -lws2_32
before running configure
.
This can be fixed by running the following commands before configure
:
$ echo libh5test_la_LIBADD=-lws2_32 >>test/Makefile.am $ automake
The third and final issue is that C++ support is not enabled by default. To enable it, add –enable-cxx
to the configure
command line:
$ ./configure --prefix=/opt/hdf --enable-cxx $ make $ make install