[GRASS-dev] compiling i.pr: error: ogr_api.h: No such file or directory

Glynn Clements glynn at gclements.plus.com
Tue Nov 27 18:39:38 EST 2007


Moritz Lennert wrote:

> Trying to compile i.pr from the GRASS Add-Ons, I get the following error:
> 
> *************
> make[1]: Entering directory 
> `/home/mlennert/SRC/GRASS/i.pr/i.pr_sites_aggregate'
> gcc -I/home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include 
> -Wall -g -O2    -I../include/   -DPACKAGE=\""grassmods"\" 
> -I/home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include -o 
> OBJ.i486-pc-linux-gnu/main.o -c main.c
> In file included from 
> /home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include/grass/vect/digit.h:3,
>                   from 
> /home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include/grass/Vect.h:4,
>                   from main.c:6:
> /home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include/grass/vect/dig_structs.h:22:21: 
> error: ogr_api.h: No such file or directory
> In file included from 
> /home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include/grass/vect/digit.h:3,
>                   from 
> /home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include/grass/Vect.h:4,
>                   from main.c:6:
> /home/mlennert/SRC/GRASS/grass6/dist.i486-pc-linux-gnu/include/grass/vect/dig_structs.h:170: 
> error: expected specifier-qualifier-list before 'OGRDataSourceH'
> main.c: In function 'main':
> main.c:90: warning: value computed is not used
> main.c:93: warning: value computed is not used
> make[1]: *** [OBJ.i486-pc-linux-gnu/main.o] Error 1
> make[1]: Leaving directory 
> `/home/mlennert/SRC/GRASS/i.pr/i.pr_sites_aggregate'
> **************
> 
> 'locate ogr_api.h' gives:
> /usr/include/gdal/ogr_api.h
> 
> The relevant lines in include/grass/vect/dig_structs.h are
> 
> #ifdef HAVE_OGR
> #include "ogr_api.h"
> #endif
> 
> When I change this to
> 
> #include "gdal/ogr_api.h"
> 
> it compiles correctly.

Strange. Does ogr_api.h use the "gdal/" prefix in headers which it
includes? What does "gdal-config --cflags" say?

> Is this a bug in grass,

I think that it's a bug in i.pr.

> i.e. should this be gdal/ogr_api.h in the headers file ?

No; "gdal" is not part of the header name, at least not in the version
I have (1.3.1). Headers don't use that to refer to themselves.

Modules which include vector headers need to have:

	EXTRA_CFLAGS = $(VECT_CFLAGS)

in their Makefile. i.pr would appear to have omitted this.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list