[GRASS5] snprintf and other compile errors on IRIX
Paul Kelly
paul-grass at stjohnspoint.co.uk
Fri Apr 26 10:26:19 EDT 2002
I've now had a chance to go over this again:
Glynn Clements wrote:
>
---snip--- various obvious bugs fixed, thank you
>
> > And the following modules had errors I couldn't fix
> >
> > Compilation error in module: src/mapdev/v.in.mif (ignored)
> >
> > cc -I/indigo-disk2/grass/grass/src/include -g
> > -I/indigo-disk2/grass/doom.ee.qub.ac.uk/include -c lex.yy.c -o
> > OBJ.mips-sgi-irix6.2/lex.yy.o
> > cfe: Error: mif.l, line 572: Syntax Error
> > {blank} |
> > ------^
> > make: *** [OBJ.mips-sgi-irix6.2/lex.yy.o] Error 1
>
> I'm not sure what it's complaining about here; if you can find out
> exactly what the error is, I'll commit the fix.
>
Still don't have a clue about this, sorry
> > Compilation error in module: src/raster/r.fill.dir (ignored)
> >
> > cc -I/indigo-disk2/grass/grass/src/include -g
> > -I/indigo-disk2/grass/doom.ee.qub.ac.uk/include -c wtrshed.c -o
> > OBJ.mips-sgi-irix6.2/wtrshed.o
> > cfe: Error: wtrshed.c, line 67: missing size for array 'dir'
> > struct whereandwhat dir[mxbuf];
> > -----------------------^
> > cfe: Error: wtrshed.c, line 67: storage size for 'dir' isn't known
> > struct whereandwhat dir[mxbuf];
> > -----------------------^
> > cfe: Error: wtrshed.c, line 67: Invalid constant expression.
> > struct whereandwhat dir[mxbuf];
> > ---------------------------^
> > cfe: Error: wtrshed.c, line 68: missing size for array 'bas'
> > struct whereandwhat bas[mxbuf];
> > -----------------------^
> > cfe: Error: wtrshed.c, line 68: storage size for 'bas' isn't known
> > struct whereandwhat bas[mxbuf];
> > -----------------------^
> > make: *** [OBJ.mips-sgi-irix6.2/wtrshed.o] Error 1
>
> I don't understand the "storage size" errors; "struct whereandwhat" is
> defined at the top of that file. But the use of "mxbuf" is a gcc-ism,
> which I'll fix (by using malloc()).
>
Yes, that fixed it. After wtrshed.c compiled all right I found a
similar problem in ppupdate.c in the same directory, which I fixed
as follows using the same syntax as you:
39c39,41
< struct links list[nbasins];
---
> struct links *list;
>
> list = G_malloc(nbasins * sizeof(struct links));
After that r.fill.dir compiled in its entirety.
> > Compilation error in module: src/raster/r.in.gdal (ignored)
> >
> > cc -L/indigo-disk2/grass/grass/src/libes/LIB.mips-sgi-irix6.2
> > -L/indigo-disk2/grass/doom.ee.qub.ac.uk/lib -o
> > /indigo-disk2/grass/grass/dist.mips-sgi-irix6.2/etc/bin/cmd/r.in.gdal
> > OBJ.mips-sgi-irix6.2/main.o OBJ.mips-sgi-irix6.2/gbgetsymbol.o
> > OBJ.mips-sgi-irix6.2/gdalbridge.o OBJ.mips-sgi-irix6.2/make_loc.o \
> > -lgis -lI -lproj -lm -lz
> > ld: ERROR 33: Unresolved text symbol "GBGetSymbol" -- 1st referenced by
> > OBJ.mips-sgi-irix6.2/gdalbridge.o.
> > ld: INFO 152: Output file removed because of error.
>
> This suggests that neither
>
> #if defined(__unix__)
> nor
> #ifdef _WIN32
>
> are true. Can you provide a suitable symbol which could be tested?
I made the following change to gbgetsymbol.c to get it to work
53c53
< #if defined(__unix__)
---
> #if defined(__unix)
Extract from IRIX cc man page:
COMMAND LINE OPTIONS (all three ABIs).
These options are specific to cc and valid in all three ABIs.
-ansi
(ANSI/ISO C only) Pure ANSI/ISO C. The symbols _MIPS_FPSET,
_MIPS_ISA, _MIPS_SIM, _MIPS_SZINT, _MIPS_SZLONG, _MIPS_SZPTR,
_LANGUAGE_C, __sgi, __unix, __host_mips, _MODERN_C, __DSO__,
_SYSTYPE_SVR4, __mips, _MIPSEB, __STDC__, and _CFE are defined to
the preprocessor. The symbol __ANSI_CPP__ is defined, and ANSI/ISO
trigraphs are processed, by default. NOTE: when compiling in pure
ANSI/ISO mode ( -ansi) several standard UNIX symbols (e.g. environ,
end) may only be referenced by their ANSI/ISO-compliant counterparts
(e.g., _environ, _end). The type 'long long' is allowed, but
results in a warning, in -ansi mode. To take advantage of this type
in libraries that refer to __int64_t and __uint64_t the user must
define the macro __LONGLONG on the command line; otherwise,
__int64_t and __uint64_t will be defined as structs. See the ANSI C
Transition Guide for more information.
-cckr
The traditional K&R/Version7 C with SGI (and some ANSI/ISO-C-like)
extensions, including function prototypes, void, void*. The symbols
_MIPS_FPSET, _MIPS_ISA, _MIPS_SIM, _MIPS_SZINT, _MIPS_SZLONG,
_MIPS_SZPTR, __EXTENSIONS__, LANGUAGE_C, _LANGUAGE_C,
__INLINE_INTRINSICS, sgi, __sgi, unix, mips, host_mips, __unix,
__host_mips, _SVR4_SOURCE, _MODERN_C, _SGI_SOURCE, __DSO__,
SYSTYPE_SVR4, _SYSTYPE_SVR4, _LONGLONG, __mips, _MIPSEB, MIPSEB, and
_CFE are defined to the preprocessor.
Hopefully this is enough information for you to get something versatile
working on all systems.
There was also a compile error in src/raster/r.le, which I forgot to
mention in my earlier e-mail. It involved strings broken over multiple
lines again, which I fixed by putting backslashes at the end of the
broken lines. The two files affected were src/raster/r.le/r.le.patch/input.c
and src/raster/r.le/r.le.pixel/input.c and the diff files for the changes
are as follows
src/raster/r.le/r.le.patch/input.c
101c101
< sampling_method->description = "Sampling method (choose only 1 method):
---
> sampling_method->description = "Sampling method (choose only 1 method):\
116,118c116,118
< att->description = "a1 = mn. pixel att. \t\ta2 = s.d. pixel att.
< \ta3 = mn. patch att. \t\ta4 = s.d. patch att.
< \ta5 = cover by gp \t\ta6 = density by gp
---
> att->description = "a1 = mn. pixel att. \t\ta2 = s.d. pixel att.\
> \ta3 = mn. patch att. \t\ta4 = s.d. patch att.\
> \ta5 = cover by gp \t\ta6 = density by gp\
127,129c127,129
< size->description = "s1 = mn. patch size\t\ts2 = s.d. patch size
< \ts3 = mn. patch size by gp\ts4 = s.d. patch size by gp
< \ts5 = no. by size class\t\ts6 = no. by size class by gp
---
> size->description = "s1 = mn. patch size\t\ts2 = s.d. patch size\
> \ts3 = mn. patch size by gp\ts4 = s.d. patch size by gp \
> \ts5 = no. by size class\t\ts6 = no. by size class by gp\
144,148c144,148
< core->description = "Core size measures (required if co1 was specified):
< \tc1 = mn. core size\t\tc2 = s.d. core size
< \tc3 = mn. edge size\t\tc4 = s.d. edge size
< \tc5 = mn. core size by gp\tc6 = s.d. core size by gp
< \tc7 = mn. edge size by gp\tc8 = s.d. edge size by gp
---
> core->description = "Core size measures (required if co1 was specified):\
> \tc1 = mn. core size\t\tc2 = s.d. core size\
> \tc3 = mn. edge size\t\tc4 = s.d. edge size\
> \tc5 = mn. core size by gp\tc6 = s.d. core size by gp\
> \tc7 = mn. edge size by gp\tc8 = s.d. edge size by gp\
157c157
< shape->description = "Shape index (choose only 1 index):
---
> shape->description = "Shape index (choose only 1 index):\
165,167c165,167
< shape_m->description = "Shape measures (required if sh1 was specified):
< \th1 = mn. patch shape\t\th2 = s.d. patch shape
< \th3 = mn. patch shape by gp\th4 = s.d. patch shape by gp
---
> shape_m->description = "Shape measures (required if sh1 was specified):\
> \th1 = mn. patch shape\t\th2 = s.d. patch shape\
> \th3 = mn. patch shape by gp\th4 = s.d. patch shape by gp\
176c176
< boundary->description = "n1 = mn. twist number n2 = s.d. twist number
---
> boundary->description = "n1 = mn. twist number n2 = s.d. twist number\
185,186c185,186
< perimeter->description = "p1 = sum of perims.\t\tp4 = sum of perims. by gp
< \tp2 = mn. per.\t\t\tp5 = mn. per. by gp
---
> perimeter->description = "p1 = sum of perims.\t\tp4 = sum of perims. by gp\
> \tp2 = mn. per.\t\t\tp5 = mn. per. by gp\
195c195
< out->description = "Name of output file for individual patch measures, when sam=w,u,r;
---
> out->description = "Name of output file for individual patch measures, when sam=w,u,r;\
src/raster/r.le/r.le.pixel/input.c
82c82
< sampling_method->description = "Sampling method (choose only 1 method):
---
> sampling_method->description = "Sampling method (choose only 1 method):\
97c97
< att->description = "b1 = mn. pixel att. b2 = s.d. pixel att.
---
> att->description = "b1 = mn. pixel att. b2 = s.d. pixel att.\
114,115c114,115
< method_code->description = "Texture method (choose only 1 method):
< \tm1 = 2N-H m2 = 2N-45 m3 = 2N-V m4 = 2N-135
---
> method_code->description = "Texture method (choose only 1 method):\
> \tm1 = 2N-H m2 = 2N-45 m3 = 2N-V m4 = 2N-135\
124,125c124,125
< measure_code->description = "Texture measures (required if te1 was specified):
< \tt1 = contagion t2 = ang. sec. mom. t3 = inv. diff. mom.
---
> measure_code->description = "Texture measures (required if te1 was specified):\
> \tt1 = contagion t2 = ang. sec. mom. t3 = inv. diff. mom.\
134c134
< juxtaposition->description = "Juxtaposition measures (weight file in r.le.para needed):
---
> juxtaposition->description = "Juxtaposition measures (weight file in r.le.para needed):\
So if all the snprintf() calls have been removed, v.in.mif
is now the only module not compiling on IRIX 6.2 (out
of those enabled in src/CMD/lists/GRASS of course). My
next big challenge is to get SG3d working with GRASS 5 (I
currently only have the non-floating point version working
with GRASS 4.3).
Paul Kelly
More information about the grass-dev
mailing list