[GRASSLIST:2294] Re: example plot_raster_map aus progmangrass (p.264)

Daniel Isenegger disen at geo.unizh.ch
Tue Jan 20 09:57:37 EST 2004


Just for info:

this thing was just an ordering problem:
LIBES= $(DISPLAYLIB) $(RASTERLIB) $(GISLIB): works

instead of
LIBES= $(GISLIB) $(DISPLAYLIB) $(RASTERLIB): does not work

why this is so important, I don't know yet ....

cheers


Hi Glynn,
thanks for you advice. I included it in the Gmakefile:

HOME=$(BIN_CMD)
# include of dirs, e.g.gis.h is in ...
EXTRA_CFLAGS= -I 
/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/include
# including of libs: e.g. D_ are in DISPLAYLIB
LIBES= $(GISLIB) $(DATETIMELIB) $(XDRLIB) $(MATHLIB) $(RASTERLIB) 
$(DISPLAYLIB) $(IMAGERYLIB) $(VASKLIB) $(VASK)
DEPLIBES= $(DEPIMAGERYLIB) $(DEPGISLIB) $(DEPVASKLIB) $(DEPVASK)

OBJ = ctest.o plotRasterMap.o
ctest: $(OBJ) $(LIBES) $(DEPLIBS)
    $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBES) $(DEPLIBES)

$(LIST): global.h
$(LIBES): #in case of library change;i.e.they must be here, if in rules
$(DEPLIBS):





and actually a different error:
/data/gis/nfp48/nfp48/ipodlas0.1/grass
  make -f OBJ.i686-pc-linux-gnu/make.rules

gcc 
-L/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu  
-o ctest OBJ.i686-pc-linux-gnu/ctest.o 
OBJ.i686-pc-linux-gnu/plotRasterMap.o -lgis   -ldatetime -lz  -lm  
-lraster -ldisplay -lI -lvask  
/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu/libI.a 
/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu/libgis.a 
/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu/libvask.a
/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu/libdisplay.a(raster.o)(.text+0x1a9): 
In function `draw_cell':
/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/display/raster.c:171: 
undefined reference to `R_move_abs'/

i have to check that: if I get any further from here

thanks dani


Daniel Isenegger wrote:


>> I tried to implement the example plot_raster_map aus progmangrass 
>> (p.264) to get used to the C-programming in GRASS.
>> I use a source code installation of grass 5.0.3 on a linux Suse 8.2
>> 
>> After several iteration of the Gmakefile and the plot_raster_map I 
>> allways get a hell of an error stack which starts with:
>  
>

>> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu/libgis.a(color_range.o)(.text+0xc2): 
>> In function `G_get_color_range':
>> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/gis/color_range.c:46: 
>> undefined reference to `floor'/
>  
>

>> # einbinden der libs: e.g. D_ are in DISPLAYLIB
>> LIBES= $(GISLIB) $(RASTERLIB) $(DISPLAYLIB) $(IMAGERYLIB) $(VASKLIB) $(VASK)
>  
>

You need to add $(MATHLIB) to this line.

To be on the safe side, use of $(GISLIB) should always be followed by:

	$(DATETIMELIB) $(XDRLIB) $(MATHLIB)

as various parts of it may depend upon one or more of those libraries.

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



Daniel Isenegger schrieb:

> Hi there,
>
> I tried to implement the example plot_raster_map aus progmangrass 
> (p.264) to get used to the C-programming in GRASS.
> I use a source code installation of grass 5.0.3 on a linux Suse 8.2
>
> After several iteration of the Gmakefile and the plot_raster_map I 
> allways get a hell of an error stack which starts with:
>
>  ./bin/gmake5
>   SRC     = 
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src
>   CMD     = 
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/CMD
>   UNUSED  = 
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/unused
>   HEADER  = head.i686-pc-linux-gnu
>   ARCH    = i686-pc-linux-gnu
>   GISBASE = 
> /home/gis/disen/links/ipodlas0.1/grass/grass5sources/grass-5.0.3/dist.i686-pc-linux-gnu 
>
>   VERSION = 5.0.3 October 2003
> #################################################################
> /data/gis/nfp48/nfp48/ipodlas0.1/grass
>   make -f OBJ.i686-pc-linux-gnu/make.rules
>
> gcc 
> -I/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/include 
> -g -O2   -I 
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/include 
>  -c plotRasterMap.c -o OBJ.i686-pc-linux-gnu/plotRasterMap.o
> gcc 
> -L/data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu 
>  -o ctest OBJ.i686-pc-linux-gnu/ctest.o 
> OBJ.i686-pc-linux-gnu/plotRasterMap.o -lgis   -lraster -ldisplay -lI 
> -lvask  -lz
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/LIB.i686-pc-linux-gnu/libgis.a(color_range.o)(.text+0xc2): 
> In function `G_get_color_range':
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/libes/gis/color_range.c:46: 
> undefined reference to `floor'/
>
>
>
>
>
> the test code looks like this:
> /* Versuch: rastermap von Grass aus zu zeichnen */
>
> #include "gis.h"    // Grass-lib einbinden
> plot_raster_map(char *name,char *mapset,int overlay) {
>
>        struct Colors colors;
>        CELL *raster;
>        int row, fd, top, bottom, left, right;
>        /* perform plotting setup */
>        D_setup(!overlay);
>        D_get_screen_window(&top, &bottom, &left, &right);
>        if (D_cell_draw_setup(&top, &bottom, &left, &right)) //ERROR
>        raster = G_allocate_cell_buf( );
>        /* open raster map, read and set the colors */
>
>        // neu eingefuegt
>        int init = G_init_colors(&colors);
>        int color_table = G_read_colors(name, mapset,&colors);
>
>        if((fd = G_open_cell_old (name, mapset)) < 0) // ERROR
>      if(G_read_colors (name, mapset, &colors) < 0) //ERROR
>        D_set_colors(&colors);
>        /* plot */
>        D_set_overlay_mode(overlay);
>        for(row=0; row >= 0; ) {
>      if (G_get_map_row(fd, raster, row) < 0) //ERROR
>      row = D_draw_cell(row, raster, &colors);
>        }
>        G_close_cell(fd);
>        G_free_colors(&colors);
>        G_free(raster);
>      }
>
>
>
>
>
>
>
> the Gmakefile like this:
> HOME=$(BIN_CMD)
>
> # include der dirs, zb hier ist gis.h
> EXTRA_CFLAGS= -I 
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3/src/include 
>
>
> # einbinden der libs: e.g. D_ are in DISPLAYLIB
> LIBES= $(GISLIB) $(RASTERLIB) $(DISPLAYLIB) $(IMAGERYLIB) $(VASKLIB) 
> $(VASK)
> DEPLIBES= $(DEPIMAGERYLIB) $(DEPGISLIB) $(DEPVASKLIB) $(DEPVASK)
>
> OBJ = ctest.o plotRasterMap.o
> ctest: $(OBJ) $(LIBES) $(DEPLIBS)
>     $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBES) $(XDRLIB)
>
> $(LIST): global.h
>
> $(GISLIB): #in case of library changes
> $(RASTERLIB):
> $(DISPLAYLIB): #muss auch hier aufgefuehrt sein, wenn unter LIBES 
> aufgefuehrt
> $(LIBES):
> $(DEPLIBS):
>
>
> did forget to include a module?
> can anybody tell me how to go on?
>
> Thanxs for any advice                Dani isenegger
>
>
>
>
>
>
>
> ps the status after the installation was;
>
> GRASS is now configured for i686-pc-linux-gnu
>
>   Source directory: 
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3
>   Build directory: 
> /home/gis/disen/links/ipodlas0.1/grass/grass5sources/grass-5.0.3
>   Installation directory:    
> /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5
>   C compiler:                gcc -g -O2
>   FORTRAN compiler:          g77
>
>   NVIZ:                       yes
>
>   X11 support:                yes
>   DBM support:                no
>   JPEG support:               yes
>   TIFF support:               yes
>   PNG support:                yes
>   GD support:                 no
>   Tcl/Tk support:             yes
>   PostgreSQL support:         yes
>   OpenGL(R) support:          yes
>   ODBC support:               yes
>   FFTW support:               no
>   BLAS support:               no
>   LAPACK support:             no
>   Motif support:              no
>   FreeType support:           no
>   GLw support:                no
>   NLS support:                no
>   Readline support:           no
>




More information about the grass-user mailing list