[GRASS5] Re: [GRASSLIST:1960] can't find statvfs.h [r.terraflow on MaxOSX]

Glynn Clements glynn.clements at virgin.net
Wed Dec 10 11:47:44 EST 2003


Hamish wrote:

> > When building grass57, I get the following errors from main.cc:
> > 
> > c++ -c -I./IOStream/include -DUSER=\"chris\" -DNODATA_FIX 
> > -D_FILE_OFFSET_BITS=64 -DELEV_FLOAT main.cc -o 
> > OBJ.powerpc-apple-darwin7.0.0/FLOAT/main.o
> > main.cc:48:25: sys/statvfs.h: No such file or directory
> > main.cc:52:17: gis.h: No such file or directory
> > In file included from main.cc:56:
> ...
> > I have NO idea why it can't find gis.h, as it is in the includes of 
> > both grass53 and grass57. Here is my configuration:
> 
> 
> r.terraflow fails to compile on MacOSX 10.3 due to a missing sys/statvfs.h.
> 
> In Debian this file is included in the libc6-dev package.
> It apparently supplies links to filesystem info.
> 
> Anyone know what Fink package or otherwise might supply this?

It's unlikely to be in a package; this is OS functionality.

However, it's possible that someone might have written a stand-alone
statvfs() wrapper, as was done for dlopen/dlsym/dlclose (the dlcompat
package).

> Or can the dependancy be written out of 
>  src.contrib/DUKE/r.terraflow/main.cc
> 
> main.cc:#include <sys/statvfs.h>
> main.cc:  struct statvfs statbuf;
> main.cc:  statvfs(getenv(STREAM_TMPDIR), &statbuf);

It could be made to use statfs() instead, i.e. change:

	#include <sys/statvfs.h>
to:
	#include <sys/statfs.h>

and change:
	  struct statvfs statbuf;
	  statvfs(getenv(STREAM_TMPDIR), &statbuf);
to:
	  struct statfs statbuf;
	  statfs(getenv(STREAM_TMPDIR), &statbuf);

Or the check could simply be removed; it's just checking available
disk space.

However, statfs() is listed as a BSD 4.4 function, so some systems may
have statvfs() but not statfs(). I can't find any standardisation
information for statvfs(), so it's possible that some systems may have
neither.

Ultimately, configure should check for both; r.terraflow should use
whichever is available, or disable the check altogether if neither are
available. Imperfect behaviour in the case of insufficient disk space
is preferable to failing to compile altogether.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list