************************************************************************ HDF5 Build and Install Instructions for MinGW ************************************************************************ Preconditions: -------------- 1. Installed MinGW (5.1.4 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.1 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. CC : C compiler command CXX : C++ compiler command FC : Fortran 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.1' directory. 2.1 Non-compressed tar archive (*.tar) $ tar xf hdf5-1.8.1.tar 2.2 Gzip'd tar archive (*.tar.gz) $ gunzip < hdf5-1.8.1.tar.gz | tar xf - 2.3 Bzip'd tar archive (*.tar.bz2) $ bunzip2 < hdf5-1.8.1.tar.bz2 | tar xf - 3. Setup Environment Building HDF5 1.8.1 requires an explicit link to libws2_32.a to handle Windows Sockets. To do this, issue the command: $ export LIBS=-lws2_32 Also, the default search path can cause trouble using ./configure in HDF5 1.8.1. Check that non-MinGW or non-msys directories are not added to the PATH. You can do this by: $ echo $PATH If there are spurious entries, specifically those related to other Windows compilers or tools, remove them by setting a new PATH without them. For example, $ export PATH=.:/usr/local/bin:/mingw/bin:/bin 4. Remove Unsupported Source There are some projects which are built by default to test performance on POSIX systems. They are irrelevent on MinGW, and can cause compiler errors. To remove these projects from the build script, open ./perform/Makefile.in Find all instances of "h5perf_serial", and remove them (along with their respective extension or targets, if they exist). Then save the file. 5. 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: "testh5mkgrp.sh" - ./tools/h5copy/Makefile.in: "testh5copy.sh" - ./tools/h5ls/Makefile.in: "testh5ls.sh" - ./tools/h5stat/Makefile.in: "testh5stat.sh" 6. Configuring Notes: 1) 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, MinGW offers versions of gcc 4.x as a "Technology Preview" or "Testing" release. These should be compatible with the latest MinGW g95, but is untested. Keep in mind that this is UNSUPPORTED, and any Fortran binaries build should be considered experimental. 2) Shared libraries can not be built on MinGW in release 1.8.1. 3) See detailed information in hdf5/release_docs/INSTALL, part 5. Full installation instructions for source distributions In short, To configure HDF5 with C Library, use $ ./configure If you would like to build the C++ library, add the parameter: --enable-cxx If you would like to build without the Zlib library, add the parameter: --without-zlib If you would like to specify the the Zlib library, there are two ways: Using --with-zlib=INCDIR,LIBDIR For example, if the zlib library is installed in /usr, which is the parent directory of directories "include" and "lib", --with-zlib=/usr/include,/usr/lib 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/usr/include $ export LDFLAGS=-L/usr/lib 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. 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=/usr/include,/usr/lib --prefix=/c/hdf5 --enable-cxx <"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/usr/include \ $ LDFLAGS=-L/usr/lib \ $ ./configure --prefix=/c/hdf5 --enable-cxx <"If no more switches, then hit Enter"> 7. 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. 8. Make Install $ make install > "output file name" 9. 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