使用Cygwin编译HDF5 API

时间:2013-09-11 13:17:45

标签: windows cygwin mingw fortran hdf5

我一直在尝试使用MinGW和Cygwin在Windows中安装HDF5 API。我已经放弃了MinGW(在无法编译HDF5-1.8.11之后),因为我需要在Fortran上使用HDF5。

在运行configure(bash)脚本时使用Cygwin和HDF5-1.8.11会产生错误,因此它甚至不会开始编译。我在this link上读到HDF5-1.8在Cygwin上编译,包括Fortran模块。我下载了旧版本(HDF5-1.8.0)并且配置正常,但编译(第二次制作)会出现以下错误:

Making all in src
make[1]: Entering directory `/cygdrive/c/hdf5-1.8.0/src'
make  all-am
make[2]: Entering directory `/cygdrive/c/hdf5-1.8.0/src'
/bin/sh ../libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.    -I/cygdrive/c/cygwin/usr/include    -DNDEBUG -UH5_DEBUG_API  -ansi -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -O3 -fomit-frame-pointer -finline-functions -MT H5Omtime.lo -MD -MP -MF .deps/H5Omtime.Tpo -c -o H5Omtime.lo H5Omtime.c
gcc -DHAVE_CONFIG_H -I. -I/cygdrive/c/cygwin/usr/include -DNDEBUG -UH5_DEBUG_API -ansi -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -O3 -fomit-frame-pointer -finline-functions -MT H5Omtime.lo -MD -MP -MF .deps/H5Omtime.Tpo -c H5Omtime.c -o H5Omtime.o
In file included from H5private.h:29:0,
             from H5Omtime.c:24:
H5public.h:154:18: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
H5public.h:155:16: warning: ISO C90 does not support ‘long long’ [-Wlong-long]
H5Omtime.c: In function ‘H5O_mtime_decode’:
H5Omtime.c:194:9: warning: implicit declaration of function ‘tzset’ [-Wimplicit-function-declaration]
H5Omtime.c:194:9: warning: nested extern declaration of ‘tzset’ [-Wnested-externs]
H5Omtime.c:230:17: error: ‘timezone’ undeclared (first use in this function)
H5Omtime.c:230:17: note: each undeclared identifier is reported only once for each function it appears in
Makefile:813: recipe for target `H5Omtime.lo' failed
make[2]: *** [H5Omtime.lo] Error 1
make[2]: Leaving directory `/cygdrive/c/hdf5-1.8.0/src'
Makefile:488: recipe for target `all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory `/cygdrive/c/hdf5-1.8.0/src'
Makefile:410: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1

我将不胜感激任何帮助!谢谢!

1 个答案:

答案 0 :(得分:0)

我能够重现此错误。配置脚本似乎设置了许多#define标志,这些标志指示timezone全局变量的存在,实际上该变量在cygwin环境中不存在,因此在错误消息中报告丢失。通过从头文件H5pubconf.h中删除#define H5_HAVE_TIMEZONE,我能够摆脱这个错误。

不幸的是,在make过程中还发生了另一个错误,也可以通过从同一个头文件H5pubconf.h中删除#define H5_HAVE_GETPWUID来避免这种错误。

虽然这并没有解释配置过程中出了什么问题,但通过这两个修改,我能够成功编译库。