[GRASS-dev] diglib test.c fails on 64bit win

Markus Metz markus.metz.giswork at googlemail.com
Tue May 18 10:34:16 EDT 2010


Glynn Clements wrote:
>
> Markus Metz wrote:
>
> In 6.x, LFS is enabled for specific libraries or modules using e.g.:
>
>        ifneq ($(USE_LARGEFILES),)
>                EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64
>        endif
>
> in the corresponding Makefile. This needs to be done on a case-by-case
> basis because not all modules are LFS-aware, e.g. because they
> calculate offsets using "int" or "long" arithmetic, or use
> fseek/ftell.

IOW, for 6.x and mingw32, each module would need to decide if it wants
to use e.g. fseeko64 or fseek.
>
> In 7.x, LFS is enabled globally by the following in Grass.make:
>
>        ifdef USE_LARGEFILES
>        LFS_CFLAGS = -D_FILE_OFFSET_BITS=64
>        endif
>
I know, I've put that there initially for vector LFS in r37943, you
recycled that in r40620 for global LFS.

> POSIX defines 3 feature-test macros:
>
>   _LARGEFILE_SOURCE
>   _LARGEFILE64_SOURCE
>   _FILE_OFFSET_BITS
>
[snip]
>
> MinGW doesn't have any of these. Instead, the 64-bit names are visible
> unless __NO_MINGW_LFS is defined. There are no fseeko/ftello functions
> (only fseeko64/ftello64), and no equivalent of _FILE_OFFSET_BITS.
>
So, how about

--- config.h.in	(revision 42291)
+++ config.h.in	(working copy)
@@ -259,8 +259,6 @@
 /*
  * Defines needed to get large file support - from cdrtools-2.01
  */
-#ifdef	USE_LARGEFILES
-
 #undef	HAVE_LARGEFILES

 #ifdef	HAVE_LARGEFILES		/* If we have working largefiles at all	   */
@@ -279,13 +277,18 @@
 				/* defined, we have fseeko()		   */

 #ifdef __MINGW32__
+/* add/remove as needed */
 #define off_t off64_t
 #define fseeko fseeko64
 #define ftello ftello64
+#define lseek lseek64
+#define tell tell64
+#define seek seek64
+#define stat stat64
+#define fstat fstat64
 #endif

 #endif	/* HAVE_LARGEFILES */
-#endif	/* USE_LARGEFILES */

 /* define if langinfo.h exists */
 #undef HAVE_LANGINFO_H


?


More information about the grass-dev mailing list