Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
diana:windows:building:hdf [2009-12-09 12:44:16] 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. |
| |
**TODO:** Figure out the exact relationship between these three. Apparently, HDF4 wants NetCDF, and NetCDF wants HDF5... | Yeah, right. Actually, [[windows:building:hdf4|HDF4]] is a nightmare, so we've left it out. |
| |
===== NetCDF ===== | ===== 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: | 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: |
| |
$ LDFLAGS=-no-undefined ./configure --prefix=/opt/netcdf --enable-shared --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 |
| |
Note the ''%%--enable-shared%%'' part; you can leave out ''%%--disable-f90%%'' and ''%%--disable-examples%%'' if you want, but keep ''%%--enable-shared%%''. | <del>Note the ''%%--enable-shared%%'' part; you can leave out ''%%--disable-f90%%'' and ''%%--disable-examples%%'' if you want, but keep ''%%--enable-shared%%''.</del> |
| |
**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: | |
| |
$ LDFLAGS="-no-undefined" ./configure --prefix=/opt/hdf --enable-shared --disable-fortran --disable-netcdf | |
$ make all install | |
| |
You //must// specify ''%%--disable-netcdf%%'', otherwise HDF4 will install headers which conflict with NetCDF! | |
| |
**TODO:** check configure options | |
| |
===== HDF5 ===== | ===== HDF5 ===== |
$ echo 'libhdf5_hl_cpp_la_LIBADD=$(LIBH5_HL)' >>hl/c++/src/Makefile.am | $ echo 'libhdf5_hl_cpp_la_LIBADD=$(LIBH5_HL)' >>hl/c++/src/Makefile.am |
| |
After editing the various ''Makefile.am''s, we need to regenerate the ''Makefile.in''s that ''configure'' uses: | Finally, HDF5's ''configure.in'' uses the ''LT_INIT'' macro, which only works with very recent versions of automake. Edit ''configure.in'' and replace these two lines: |
| |
| LT_PREREQ([2.2]) |
| LT_INIT([dlopen]) |
| |
| with this: |
| |
| AC_LIBTOOL_DLOPEN |
| AM_PROG_LIBTOOL |
| |
| **XXX** alternative: use more recent [[windows:building:autotools|autotools]] versions, but this has repercussions for all other components |
| |
| Now we need to regenerate everything: |
| |
$ aclocal | $ aclocal |
$ automake | $ libtoolize --copy --force |
| $ autoheader |
| $ automake --add-missing --copy --foreign |
| $ autoconf |
| |
The fourth and final issue is that C++ support is not enabled by default. To enable it, add ''--enable-cxx'' to the ''configure'' command line. | The fourth and final issue is that C++ support is not enabled by default. To enable it, add ''--enable-cxx'' to the ''configure'' command line. |
Finally: | Finally: |
| |
$ LDFLAGS=-no-undefined ./configure --prefix=/opt/hdf --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! |