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

Hamish hamish_nospam at yahoo.com
Wed Dec 10 23:57:25 EST 2003


> > > > 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
> > > 
> > > r.terraflow fails to compile on MacOSX 10.3 due to a missing
> > > sys/statvfs.h.
...
> > > 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);
> > 
...
> > the check could simply be removed; it's just checking available
> > disk space.
...
> > 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.


I applied the following patch to src.contrib/DUKE/r.terraflow/main.cc
to disable the statvfs code locally:

Index: main.cc
===================================================================
RCS file: /home/grass/grassrepository/grass/src.contrib/DUKE/r.terraflow/main.cc,v
retrieving revision 1.2
diff -u -r1.2 main.cc
--- main.cc     27 Sep 2003 09:55:51 -0000      1.2
+++ main.cc     11 Dec 2003 04:40:58 -0000
@@ -45,8 +45,10 @@
 #include <ctype.h>
 #include <time.h>
 #include <sys/types.h>
-#include <sys/statvfs.h>
 
+#ifdef HAVE_STATVFS_H
+#include <sys/statvfs.h>
+#endif
 
 extern "C" {
 #include "gis.h"
@@ -425,7 +427,8 @@
   fprintf(stderr, "Will need at least %s space available in %s\n",
                  formatNumber(buf, maxneed),             /* need 2*N to sort */
                  getenv(STREAM_TMPDIR));
-  
+
+#ifdef HAVE_STATVFS_H
   fprintf(stderr, "Checking current space in %s: ", getenv(STREAM_TMPDIR));
   struct statvfs statbuf;
   statvfs(getenv(STREAM_TMPDIR), &statbuf);
@@ -439,6 +442,8 @@
        fprintf(stderr, ". Not enough space available.\n");
        exit(1);
   }
+#endif
+
 }



But it still doesn't compile:

[...]
c++ -c -I/Users/hb/src/grass53/src/include -I/usr/X11R6/include -I/sw/include -g -O2  -I/usr/X11R6/include -I/sw/include   -I./IOStream/include -DUSER=\"hb\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64 -DELEV_FLOAT fill.cc -o OBJ.powerpc-apple-darwin7.0.0/FLOAT/fill.o
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = plateauType, Compare = 
   ijCmpPlateauType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = plateauType, Compare = ijCmpPlateauType]'
sortutils.h:105:   instantiated from `AMI_STREAM<T>* sort(AMI_STREAM<T>*, FUN) [with T = plateauType, FUN = ijCmpPlateauType]'
fill.cc:231:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = plateauType]'
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = labelElevType, Compare = 
   ijCmpLabelElevType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = labelElevType, Compare = ijCmpLabelElevType]'
sortutils.h:66:   instantiated from `void sort(AMI_STREAM<T>**, FUN) [with T = labelElevType, FUN = ijCmpLabelElevType]'
fill.cc:298:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = labelElevType]'
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = boundaryType, Compare = 
   elevCmpBoundaryType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = boundaryType, Compare = elevCmpBoundaryType]'
sortutils.h:66:   instantiated from `void sort(AMI_STREAM<T>**, FUN) [with T = boundaryType, FUN = elevCmpBoundaryType]'
fill.cc:317:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = boundaryType]'
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = labelElevType, Compare = 
   labelCmpLabelElevType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = labelElevType, Compare = labelCmpLabelElevType]'
sortutils.h:105:   instantiated from `AMI_STREAM<T>* sort(AMI_STREAM<T>*, FUN) [with T = labelElevType, FUN = labelCmpLabelElevType]'
fill.cc:414:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = labelElevType]'
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = waterType, Compare = 
   ijCmpWaterType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = waterType, Compare = ijCmpWaterType]'
sortutils.h:105:   instantiated from `AMI_STREAM<T>* sort(AMI_STREAM<T>*, FUN) [with T = waterType, FUN = ijCmpWaterType]'
fill.cc:562:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = waterType]'
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = boundaryType, Compare = 
   ijCmpBoundaryType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = boundaryType, Compare = ijCmpBoundaryType]'
sortutils.h:66:   instantiated from `void sort(AMI_STREAM<T>**, FUN) [with T = boundaryType, FUN = ijCmpBoundaryType]'
fill.cc:674:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = boundaryType]'
IOStream/include/ami_sort_impl.h: In function `queue<char*>* 
   runFormation(AMI_STREAM<T>*, Compare*) [with T = boundaryType, Compare = 
   waterCmpBoundaryType]':
IOStream/include/ami_sort.h:123:   instantiated from `AMI_err AMI_sort(AMI_STREAM<T>*, AMI_STREAM<T>**, Compare*, int) [with T = boundaryType, Compare = waterCmpBoundaryType]'
sortutils.h:66:   instantiated from `void sort(AMI_STREAM<T>**, FUN) [with T = boundaryType, FUN = waterCmpBoundaryType]'
fill.cc:680:   instantiated from here
IOStream/include/ami_sort_impl.h:206: error: could not convert `nb_runs' to `
   unsigned int&'
IOStream/include/ami_sort_impl.h:69: error: in passing argument 4 of `void 
   initializeRunFormation(AMI_STREAM<T>*, size_t&, size_t&, unsigned int&) 
   [with T = boundaryType]'
make: *** [OBJ.powerpc-apple-darwin7.0.0/FLOAT/fill.o] Error 1



??

thanks,
Hamish




More information about the grass-dev mailing list