----- Original Message -----
From: "Allen D Byrne" <[email protected]>
To: <[email protected]>
Cc: "Sisyphus" <[email protected]>
Sent: Tuesday, April 24, 2012 11:41 PM
Subject: Re: [Hdf-forum] Problems compiling hdf5 under MingW:
undefinedreference to 'ftruncated64'
(I build with configure, not cmake.)
I checked the code, there is an define H5_HAVE_MINGW that must be set.
Should H5_HAVE_WIN32_API also be set for MinGW ? I gather it *should* be
defined, but I don't know whether it is. How do I check ?
Similarly, how do I tell whether H5_HAVE_MINGW is defined for my build ?
"H5_HAVE_MINGW" is a bit of a mystery - I can't find it in any of the source
header files, and the only src/*.c file that references it is H5FDstdio.c.
In that file we find:
#ifdef H5_HAVE_WIN32_API
#ifndef H5_HAVE_MINGW
#define file_fseek _fseeki64
#define file_offset_t __int64
#define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */
#define file_ftell _ftelli64
#endif /* H5_HAVE_MINGW */
#endif /* H5_HAVE_WIN32_API */
Quite clearly, if we're running MinGW then the intention is that none of
those defines should be set - and I find that none of those defines are set.
So that part is fine. (Mind you, I presently don't know if they're unset
because H5_HAVE_WIN32_API is not defined for me, or because H5_HAVE_MINGW
*is* defined for me.)
The problem with H5FDstdio.c occurs in the very next block of defines:
#ifndef file_fseek
#ifdef H5_HAVE_FSEEKO64
#define file_fseek fseeko64
#define file_offset_t off64_t
#define file_ftruncate ftruncate64
#define file_ftell ftello64
#else
#define file_fseek fseeko
#define file_offset_t off_t
#define file_ftruncate ftruncate
#define file_ftell ftello
#endif /* H5_HAVE_FSEEKO64 */
#endif /* file_fseek */
It assumes that if H5_HAVE_FSEEKO64 is defined, then H5_HAVE_FTRUNCATE64 is
also defined.
The assumption is correct for my 64-bit MinGW (gcc-4.7.0), but not for my
32-bit MinGW (gcc-4.5.2).
Similarly, both H5FDdirect.c and H5FDmpiposix.c assume that if
H5_HAVE_LSEEK64 is defined, then H5_HAVE_FTRUNCATE64 is also defined - which
is again true for my 64-bit MinGW, but not for my 32-bit MinGW.
Cheers,
Rob
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org