[GRASS-dev] Re: [GRASS-user] r.in.xyz: Could open text file ~ 2.5GB

Hamish hamish_nospam at yahoo.com
Tue Oct 24 01:46:04 EDT 2006

Glynn Clements wrote:
> I forgot that the --enable-largefile switch only enables LFS in
> libgis, not anywhere else.
> [Although config.h includes definitions to enable LFS automatically,
> those definitions are currently inactive. This is probably a good
> thing; a lot of GRASS' code isn't LFS-aware, and explicit failure is
> preferable to silently corrupting data.]
> To enable LFS elsewhere, you need to manually add
> -D_FILE_OFFSET_BITS=64 to the compilation flags. The simplest approach
> is to add:
> ifneq ($(USE_LARGEFILES),)
> endif
> to raster/r.in.xyz/Makefile, then repeat the "make" and "make install"
> steps.

I have added this knowledge (and some other tips posted to the mailing
list by Glynn & Brad) to a page in the Development section of the Wiki.
Please correct, update, and expand as needed.


how hard will it be to get a HAVE_FTELLO (or whatever) switch tested &
set by ./configure? If we get that, should every LFS compliant module be
written like:

    off_t filesize;
    long filesize;


    fseeko(in_fd, 0L, SEEK_END);
    filesize = ftello(in_fd);
    fseek(in_fd, 0L, SEEK_END);
    filesize = ftell(in_fd);

Or is that better handled in G_fseek() etc fns etc as suggested by Brad?
(still should try and match variable type in that case (how?))

fopen() and fclose() are ok in both cases? (dependant on finding
-D_FILE_OFFSET_BITS=64 in the Makefile and including grass/config.h ?)

I'm trying to make that wiki page a "best practices" guide for GRASS
developers, so direct updates there would be appreciated.


More information about the grass-dev mailing list