1

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

在运行配置 (bash) 脚本时,将 Cygwin 与 HDF5-1.8.11 一起使用会产生错误,因此它甚至不会开始编译。我在这个链接上读到 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

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

4

1 回答 1

0

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

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

尽管这并不能解释配置过程中真正出了什么问题,但通过这两个修改,我能够成功编译该库。

于 2013-09-25T19:06:05.010 回答