************************************************************************ HDF5 Build and Install Instructions for MinGW ************************************************************************ Preconditions: -------------- 1. Installed MinGW (5.1.2 or higher) and MSYS (1.0.10 or higher) To install the MinGW net release, go to http://www.mingw.org and click on "Install or update now!" icon. This will download a GUI installer called setup.txt which can be run to download a complete MinGW installation via the internet. Then follow the instructions on each screen to install MinGW. 2. Compilers Installed 2.1 C/C++ Compilers HDF5-1.8.0 Supported gcc-3.4.2 is included in MinGW, which includes: gcc : GNU C compiler gcc-g++: GNU C++ compiler 2.2 Using Compilers Not Supported The compilers in 2.1 are supported and tested by The HDF Group. Any other compilers may still work but they are not guaranteed by HDF group. If users want to use other compilers except those in 2.1, try to set the following variables to override the default choices. CXX : C++ compiler command 3. HDF5 Dependencies 3.1 Zlib zlib-1.2.2 or later is supported and tested on MinGW. 3.2 Szip The HDF5 library has a predefined compression filter that uses the extended-Rice lossless compression algorithm for chunked datatsets. For more information about Szip compression and license terms see http://hdfgroup.org/HDF5/doc_resource/SZIP/index.html. Szip is currently not supported on MinGW, although we plan to add support in the future. Build HDF5 on MinGW ---------------------- 1. Get HDF5 source code package Users can download HDF5 source code package from HDF website (http://hdfgroup.org). 2. Unpacking the distribution The HDF5 source code is distributed in a variety of formats which can be unpacked with the following commands, each of which creates an `hdf5-1.8.0' directory. 2.1 Non-compressed tar archive (*.tar) $ tar xf hdf5-1.8.0.tar 2.2 Gzip'd tar archive (*.tar.gz) $ gunzip < hdf5-1.8.0.tar.gz | tar xf - 2.3 Bzip'd tar archive (*.tar.bz2) $ bunzip2 < hdf5-1.8.0.tar.bz2 | tar xf - 3. Setup Environment Building HDF5 1.8.0 requires an explicit link to libws2_32.a to handle Windows Sockets. To do this, issue the command: $ export LIBS=-lws2_32 4. Remove Tests When building with MinGW, many tests must be removed from the test suite run with "make check". This is because of the way MinGW and Windows handles certain parsing. For example, MinGW treats any command parameter starting with '/' as a path, and replaces it with it's root directory on Windows, such as 'C:\msys\1.0\'. To remove the tests, open the given 'Makefile.in' and edit the line begining with "TEST_SCRIPT = " to remove the test script. For example, to remove the "testerror.sh" from ./test/Makefile.in: 1) Open ./test/Makefile.in 2) Find the line "TEST_SCRIPT = $(top_srcdir)/test/testerror.sh" 3) Change it to simply read "TEST_SCRIPT =", and save. Do this for the following Makefiles and tests: - ./test/Makefile.in: "testerror.sh" - ./tools/h5dump/Makefile.in: "testh5dump.sh" and "testh5dumpxml.sh" - ./tools/h5diff/Makefile.in: "testh5diff.sh" - ./tools/misc/Makefile.in: "testh5stat.sh" and "testh5mkgrp.sh" - ./tools/h5jam/Makefile.in: "testh5jam.sh" - ./tools/h5copy/Makefile.in: "testh5copy.sh" - ./tools/h5ls/Makefile.in: "testh5ls.sh" 5. Configuring Notes: 1) The stream vfd in HDF5 is not supported on MinGW. Therefore, each configuration must incude the parameter "--disable-stream-vfd". 2) Building Fortran libraries is also currently unsupported. This is because the current release of gcc for mingw (3.4.5) is not compatible with the current g95 for mingw (g95 0.91!, gcc version 4.0.3). However, if you would like to build gcc 4.x on your own, there are instructions for doing so here: http://www.mingw.org/MinGWiki/index.php/How%20to%20Compile%20GCC%204.1 Remember that this is UNSUPPORTED, and any Fortran binaries build should be considered experimental. 4) Shared libraries can not be built on MinGW in release 1.8.0. 3) See detailed information in hdf5/release_docs/INSTALL, part 5. Full installation instructions for source distributions In short, 5.1 To configure HDF5 with C Library, use $ ./configure --disable-stream-vfd 5.2 If you would like to build the C++ library, add the parameter: --enable-cxx 5.3 If you would like to build without the Zlib library, add the parameter: --without-zlib 5.4 If you would like to specify the the Zlib library, there are two ways: 5.4.1 Using --with-zlib=INCDIR,LIBDIR For example, if the zlib library is installed in /c/usr, which is the parent directory of directories "include" and "lib", --with-zlib=/c/usr/include,/c/usr/lib 5.4.2 Through the CPPFLAGS and LDFLAGS Variables For example, if zlib was installed in the directory /c/usr then using the following command to configure HDF5 with zib $ export CPPFLAGS=-I/c/usr/include $ export LDFLAGS=-L/c/usr/lib 5.6 If you would like to specify the install directory, add the parameter: --prefix="path for installation" By default, HDF5 library, header files, examples, and support programs will be installed in /usr/local/lib, /usr/local/include, /usr/local/doc/hdf5/examples, and /usr/local/bin. To use a path other than /usr/local specify the path with the `--prefix=PATH' switch as in the above command. 5.7 Combination of Switches All of the above switches can be combined together. For example, if users want to configure HDF5 C/C++ library, with zlib library at /c/usr/, and install HDF5 into directory /c/hdf5 using gcc/g++ as C/C++ compiler: $ ./configure --with-zlib=/c/usr/include,/c/usr/lib --prefix=/c/hdf5 --enable-cxx --disable-stream-vfd <"If no more switches, then hit Enter"> Notes: The command format above is for readilibity. In practice, please type in the command above with at least one space between each line, No "Enter" until users finish the switches and want to run the configure. or do it through CPPFLAGS and LDFLAGS variables: $ CPPFLAGS=-I/c/usr/include \ $ LDFLAGS=-L/c/usr/lib \ $ ./configure --prefix=/c/hdf5 --enable-cxx --disable-stream-vfd <"If no more switches, then hit Enter"> 6. Make and Make Check After configuration is done successfully, run the following series of commands to build, test and install HDF5 $ make > "output file name" $ make check > "output file name" Before run "make install", check output file for "make check", there should be no failures at all. 7. Make Install $ make install > "output file name" 8. Check installed HDF5 library After step 4, go to your installation directory, there should be three subdirectories: "bin" "include" and "lib". ----------------------------------------------------------------------- Need Further assistance, email help@hdfgroup.org