GRASS5.0beta2 compiled on SGI Origin 2000
Justin Hickey
jhickey at impact1.hpcc.nectec.or.th
Wed Aug 11 09:58:26 EDT 1999
Hello all
Last week I was asked to post this so here it is. We recently compiled
grass5.0beta2 on our SGI Origin 2000 running IRIX 6.5. The compile was full of
thousands of warnings, but only 19 changes were required to compile it error
free. These changes are attached with the reasons we thought caused the errors
for anyone who is interested. There was a change that we had to make to the
configure script but I'm not sure if it is a good change since we are not
familiar with how confuigure scripts work.
One thing to note was that we used the SGI compilers with the option for
parallelizing code if it was possible. This option didn't effect the compile of
the program in terms of causing errors but we are not sure if it has provided
any benefit. So far, d.rast using the spearfish database seemes to use multiple
processors but the time is about the same as a single processor. Also
r.surf.contour does not appear to use multiple processors but then again, we
never had it run completely (see the previous post).
Hope this is useful to someone.
--
Sincerely,
Jazzman (a.k.a. Justin Hickey) e-mail: jhickey at hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand
==================================================================
People who think they know everything are very irritating to those
of us who do. ---Anonymous
Jazz and Trek Rule!!!
==================================================================
-------------- next part --------------
Changes made to code and other files to get grass to compile on SGI Origin 2000
IRIX 6.5 with vendor compilers
1.
First see changes to the configure script from the error reported in step 6
below.
Added a compiler flag to attempt to parallelize the code. Added -apo to the
COMPILE_FLAGS (line 13) and LDFLAGS (line 14) definitions in the file
grass5.0beta2/src/CMD/head/head after running the configure script.
2.
Module: grass5.0beta2/src/libes/bitmap
File: grass5.0beta2/src/include/bitmap.h
Error: line 23: error(1079): expected a type specifier
// char *token;
Fix: This is a C++ comment not a C comment - changed code to C comment
3.
Module: grass5.0beta2/src/display/devices/lib
File: SWITCHER.c
Error: line 899: error(1133): expression must be a modifiable lvalue
if ((stat=get1(((char* )buf)++)) != 0)
Fix: The buf variable is being cast and incremented but the result of the
cast is not stored. This is dangerous since types of pointers
being used may be of different size. If they are different in size
then buf is not aligned properly for it's next access. For example
if buf is initially an int pointer (32 bits) and the cast and
increment above are performed twice, then buf no longer points to a
proper int. Therefore buf needs to be cast to another temporary
variable for incrementing. Changed code from
int stat;
while (n-- > 0)
if ((stat=get1(((char* )buf)++)) != 0)
return stat; /* EOF or COMMAND_ESC */
return 0;
to the folowing:
int stat;
char *tempBuf;
tempBuf = (char* )buf;
while (n-- > 0)
if ((stat=get1(tempBuf++)) != 0)
return stat; /* EOF or COMMAND_ESC */
return 0;
4.
Module: grass5.0beta2/src/display/devices/lib
File: font.c
Error: line 119: error(1133): expression must be a modifiable lvalue
(char)*a++ = *b++;
Fix: This is the same as for SWITCHER.c in error 2 above. The only call
for the function for this line of code is commented out with a
statement concerning alignment errors (see the discussion for the
fix in error 2 above). So the function X_copy was commented out
since it is a static function and can only be called from within
the same file. Also the prototype at line 14 was commented out.
5.
Module: grass5.0beta2/src/display/devices/XDRIVER/XDRIVER24
File: SWITCHER.c
Error: line 141: error(1029): expected an expression
debug("Initialize Graphics");
Plus 16 more of the same (ie every call to debug)
Fix: These errors are caused by having the debug call defined as a C++
comment on line 35. Since DEBUG is not defined, all the calls to
debug are replaced with C++ comments. To fix this the else part of
#ifdef DEBUG was defined to contain an empty function. Changed line
35 from:
#define debug //
to the following:
#include <stdarg.h>
int debug(char *x,...) {}
6.
Module: grass5.0beta2/src/general/g.help
File: menu.c
Error: line 742: error(1565): struct "_win_st" has no field "NONE"
Maxlines = ((short)Numlines <= Windoname->CURSES_MAXY) ?
line 743: error(1565): struct "_win_st" has no field "NONE"
Numlines : Windoname->CURSES_MAXY;
line 814: error(1565): struct "_win_st" has no field "NONE"
Maxlines = ((short)Numlines <= Windoname->CURSES_MAXY) ?
line 815: error(1565): struct "_win_st" has no field "NONE"
Numlines : Windoname->CURSES_MAXY;
Fix: The NONE value is defined due to an error found in code generated by
the grass5.0beta2/configure script. The code in the configure script
checks the WINDOW structure in curses.h and is as follows starting
from line 2322:
CURSES_MAXY=NONE
cat > conftest.$ac_ext <<EOF
#line 2325 "configure"
#include "confdefs.h"
#include <curses.h>
WINDOW w;
int main() {
void t () { w.maxy = 0; }
; return 0; }
EOF
and again starting at line 2342:
cat > conftest.$ac_ext <<EOF
#line 2344 "configure"
#include "confdefs.h"
#include <curses.h>
WINDOW w;
int main() {
void t () { w._maxy = 0; }
; return 0; }
EOF
The problem with this code is that it generates an error due to the
definition of the function t() inside main(). C does not support
nested functions. This error was reported in the config.log file.
The solution for this error was to delete the t() function
definition in the configure script. As well, the same definition was
found in the configure.in file and was deleted from that file as
well. This was done since we do not really know how configure works
so we deleted both instances of the code to ensure that the fix
worked. Another solution may be better, but this one worked for us.
The following is the new code:
CURSES_MAXY=NONE
cat > conftest.$ac_ext <<EOF
#line 2325 "configure"
#include "confdefs.h"
#include <curses.h>
WINDOW w;
int main() {
w.maxy = 0;
; return 0; }
EOF
then at line 2342
cat > conftest.$ac_ext <<EOF
#line 2344 "configure"
#include "confdefs.h"
#include <curses.h>
WINDOW w;
int main() {
w._maxy = 0;
; return 0; }
EOF
7.
Module: grass5.0beta2/src/imagery/i.gensig/inter
File: Gmakefile
Error: ld32: ERROR 33: Unresolved text symbol "mp_in_parallel_region" --
1st referenced by
/usr1/grass/grass5.0beta2/src/libes/LIB.mips-sgi-irix6.5/libgis.a
(null_val.o).
Plus 3 more of the same
Fix: Since we are using the -apo option for parallel processing, the
LDFLAGS are required on the command line. This Gmakefile does not
specify the LDFLAGS variable in the cc command line so it was added
as follows:
$(CC) $(LDFLAGS) main.o $(LIBES) $(VASK) $(MATHLIB) $(XDRLIB)
8.
Module: grass5.0beta2/src/imagery/i.gensigset/cmd
File: read_data.c
Error: line 3: error(1166): expected a declaration
// #include "local_proto.h"
Fix: This is a C++ comment not a C comment - changed code to C comment
9.
Module: grass5.0beta2/src/imagery/i.gensigset/inter
File: Gmakefile
Error: ld32: ERROR 33: Unresolved text symbol "mp_in_parallel_region" --
1st referenced by
/usr1/grass/grass5.0beta2/src/libes/LIB.mips-sgi-irix6.5/libgis.a
(null_val.o).
Fix: Since we are using the -apo option for parallel processing, the
LDFLAGS are required on the command line. This Gmakefile does not
specify the LDFLAGS variable in the cc command line so it was added
as follows:
$(CC) $(LDFLAGS) main.o $(LIBES) $(VASK) $(MATHLIB) $(XDRLIB)
10.
Module: grass5.0beta2/src/imagery/i.rectify3/cmd
File: protodefs.h
Error: line 82: error(1166): expected a declaration
//void CRS_georef2(...);
line 83: error(1166): expected a declaration
//int CRS_georef(...);
line 84: error(1166): expected a declaration
//int CRS_compute_CP_georef_equations(...);
Fix: These are C++ comments not C comments - changed code to C comments
11.
Module: grass5.0beta2/src/mapdev/georef
File: ../digitizers/dig_inter.h
Error: line 76: error(1166): expected a declaration
// int jtimeout(void);
line 90: error(1166): expected a declaration
//int delay(int n);
Fix: These are C++ comments not C comments - changed code to C comments
12.
Module: grass5.0beta2/src/mapdev/v.in.dxf
File: Gmakefile
Error: ld32: ERROR 33: Unresolved text symbol "mp_in_parallel_region" --
1st referenced by OBJ.mips-sgi-irix6.5/which_layer.o.
Plus 3 more of the same
Fix: Since we are using the -apo option for parallel processing, the
LDFLAGS are required on the command line. This Gmakefile redefines
the LDFLAGS to nothing so this line (line 6) was commented out.
13.
Module: grass5.0beta2/src/misc/m.proj
File: local_proto.h
Error: line 2: error(1166): expected a declaration
// int get_enz(void);
Plus 17 more at lines 3-12, 14, 15, 17, 24, 26, 27, and 28
Fix: These are C++ comments not C comments - changed code to C comments
14.
Module: grass5.0beta2/src/paint/Interface/driverlib
File: interface.c
Error: line 375: error(1133): expression must be a modifiable lvalue
(char *)buf += i;
Fix: Alignment problems like those in error from step 3 above. Code was
changed from the followinmg:
int i;
while (n > 0)
{
i = read (0, buf, n);
if (i == 0)
paint_error ("unexpected EOF");
if (i < 0)
paint_error ("read error");
(char *)buf += i;
n -= i;
}
to the following:
int i;
char *tempBuf;
tempBuf = (char*) buf;
while (n > 0)
{
i = read (0, buf, n);
if (i == 0)
paint_error ("unexpected EOF");
if (i < 0)
paint_error ("read error");
/* (char *)buf += i;*/
tempBuf += i;
n -= i;
}
15.
Module: grass5.0beta2/src/paint/Programs/p.map.new/cmd
File: text.h
Error: line 37: error(1166): expected a declaration
// int graph_text(...);
Fix: This is a C++ comment not a C comment - changed code to C comment
16.
Module: grass5.0beta2/src/raster/r.cost/cmd
File: local_proto.h
Error: line 3: error(1166): expected a declaration
// int check_all(char *);
line 5: error(1166): expected a declaration
// int time_to_stop(int, int);
Fix: These are C++ comments not C comments - changed code to C comments
17.
Module: grass5.0beta2/src/raster/r.mapcalc/mapcalc
File: maps.c
Error: line 336: error(1133): expression must be a modifiable lvalue
(char *)values = vbuf, sizeof(vbuf));
Fix: Alignment problems but this time the cast was being performed before
the assignment. Therefore parentheses were added to the assignment
as follows:
(char *)(values = vbuf), sizeof(vbuf));
18.
Module: grass5.0beta2/src/raster/r.poly/cmd
File: io.c
Error: line 100: error(1166): expected a declaration
//static struct area_table *areas;
Fix: This is a C++ comment not a C comment - changed code to C comment
19.
Module: grass5.0beta2/src/sites/s.surf.rst/v.surf.rst
File: main.c
Error: line 607: error(1029): expected an expression
&xmin, &xmax, &ymin, &ymax, &zmin, &zmax, &NPOINT); // , dmax);
Fix: This is a C++ comment not a C comment - changed code to C comment
20.
Module: grass5.0beta2/src/sites/s.territory
File: main.c
Error: line 191: error(1029): expected an expression
G_site_put (out_sfd, outsite); // , (rtype != -1));
Fix: This is a C++ comment not a C comment - changed code to C comment
More information about the grass-user
mailing list