[GRASS-dev] compiling today's grass7 trunk: ogr_srs_api.h: No such file or directory

I get the following error running make in swig/python in grass7 of today (rev 37908).

In file included from proj_wrap.c:2694:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:23:29: error: ogr_srs_api.h: No such file or directory
In file included from proj_wrap.c:2694:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:84: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GPJ_grass_to_osr'
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:88: error: expected declaration specifiers or '...' before 'OGRSpatialReferenceH'
make[1]: *** [OBJ.i486-pc-linux-gnu/proj_wrap.o] Error 1
make[1]: Leaving directory `/home/mlennert/SRC/GRASS/grass_trunk/swig/python'
make: *** [default] Error 2

The file ogr_srs_api.h sits in /usr/include/gdal/.

Any ideas of what is wrong here ?

I also get a make errors for a few scripts (v.in.garmin, v.in.gpsbabel, v.out.gps, r.li/r.li.setup) but I guess this is linked to the fact that they haven't been ported to python, yet ?

Moritz

Moritz Lennert wrote:

I get the following error running make in swig/python in grass7 of today
(rev 37908).

In file included from proj_wrap.c:2694:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:23:29:
error: ogr_srs_api.h: No such file or directory

The file ogr_srs_api.h sits in /usr/include/gdal/.

Any ideas of what is wrong here ?

The libgrass_gproj wrapper includes <grass/gprojects.h>, which
includes ogr_srs_api.h. It adds (or should add) $(PROJINC) and
$(GDALCFLAGS) when compiling the wrapper.

I also get a make errors for a few scripts (v.in.garmin, v.in.gpsbabel,
v.out.gps, r.li/r.li.setup) but I guess this is linked to the fact that
they haven't been ported to python, yet ?

Yes.

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

On 16/06/09 17:14, Glynn Clements wrote:

Moritz Lennert wrote:

I get the following error running make in swig/python in grass7 of today (rev 37908).

In file included from proj_wrap.c:2694:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:23:29: error: ogr_srs_api.h: No such file or directory

The file ogr_srs_api.h sits in /usr/include/gdal/.

Any ideas of what is wrong here ?

The libgrass_gproj wrapper includes <grass/gprojects.h>, which
includes ogr_srs_api.h. It adds (or should add) $(PROJINC) and
$(GDALCFLAGS) when compiling the wrapper.

In swig/python/Makefile, I see

proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)

but I don't really understand where this comes into play. Am I the only one seeing this error ?

Moritz

Moritz Lennert wrote:

>> I get the following error running make in swig/python in grass7 of today
>> (rev 37908).
>>
>> In file included from proj_wrap.c:2694:
>> /home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:23:29:
>> error: ogr_srs_api.h: No such file or directory
>
>> The file ogr_srs_api.h sits in /usr/include/gdal/.
>>
>> Any ideas of what is wrong here ?
>
> The libgrass_gproj wrapper includes <grass/gprojects.h>, which
> includes ogr_srs_api.h. It adds (or should add) $(PROJINC) and
> $(GDALCFLAGS) when compiling the wrapper.

In swig/python/Makefile, I see

proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)

but I don't really understand where this comes into play.

This should ensure that proj_wrap.c can find the PROJ and GDAL
headers.

Am I the only one seeing this error ?

I don't see it. It would be help if you post the gcc command which
generates the error message.

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

OSX Xcode 3.1/GCC 4.0 here

On Jun 17, 2009, at 4:59 PM, Glynn Clements wrote:

Moritz Lennert wrote:

In swig/python/Makefile, I see

proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)

but I don't really understand where this comes into play.

This should ensure that proj_wrap.c can find the PROJ and GDAL
headers.

Am I the only one seeing this error ?

I don't see it. It would be help if you post the gcc command which
generates the error message.

I had the same problem a few weeks ago and mentioned it on the list. For some reason, proj_wrap_c_FLAGS isn't getting into the compile command.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Mon Dieu! but they are all alike. Cheating, murdering, lying, fighting, and all for things that the beasts of the jungle would not deign to possess - money to purchase the effeminate pleasures of weaklings. And yet withal bound down by silly customs that make them slaves to their unhappy lot while firm in the belief that they be the lords of creation enjoying the only real pleasures of existence....

- the wisdom of Tarzan

On 17/06/09 23:59, Glynn Clements wrote:

Moritz Lennert wrote:

I get the following error running make in swig/python in grass7
of today (rev 37908).

In file included from proj_wrap.c:2694: /home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:23:29:
error: ogr_srs_api.h: No such file or directory The file
ogr_srs_api.h sits in /usr/include/gdal/.

Any ideas of what is wrong here ?

The libgrass_gproj wrapper includes <grass/gprojects.h>, which includes ogr_srs_api.h. It adds (or should add) $(PROJINC) and $(GDALCFLAGS) when compiling the wrapper.

In swig/python/Makefile, I see

proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)

but I don't really understand where this comes into play.

This should ensure that proj_wrap.c can find the PROJ and GDAL headers.

Yes, but what I meant is that I don't see where the proj_wrap_c_FLAGS
variable is read.

Am I the only one seeing this error ?

I don't see it. It would be help if you post the gcc command which generates the error message.

gcc
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-Wall -g -O2 -fPIC -I/usr/include/python2.5 -I/usr/include/python2.5
-DPACKAGE=\""grasslibs"\"
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o
OBJ.i486-pc-linux-gnu/proj_wrap.o -c proj_wrap.c
In file included from proj_wrap.c:2694:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:23:29:
error: ogr_srs_api.h: No such file or directory
In file included from proj_wrap.c:2694:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:84:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'GPJ_grass_to_osr'
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/gprojects.h:88:
error: expected declaration specifiers or '...' before
'OGRSpatialReferenceH'
make[1]: *** [OBJ.i486-pc-linux-gnu/proj_wrap.o] Error 1
make[1]: Leaving directory
`/home/mlennert/SRC/GRASS/grass_trunk/swig/python'
make: *** [default] Error 2

So it seems that the gdal includes directory is not taken into account.

In include/Make/Platform.make I see:

GDALCFLAGS = -I/usr/include/gdal
[...]
PROJINC = $(GDALCFLAGS)

so at least /usr/include/gdal should be in the gcc line, I guess.

Moritz

Moritz Lennert wrote:

>> In swig/python/Makefile, I see
>>
>> proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)
>>
>> but I don't really understand where this comes into play.
>
> This should ensure that proj_wrap.c can find the PROJ and GDAL
> headers.

Yes, but what I meant is that I don't see where the proj_wrap_c_FLAGS
variable is read.

include/Make/Compile.make:

$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS) $($*_c_FLAGS) | $(OBJDIR)
  $(call compiler_c)

$* is the stem, i.e. the part of the name which the % matches, so if
the target is $(OBJDIR)/proj_wrap.c, $* is proj_wrap and $*_c_FLAGS is
proj_wrap_c_FLAGS.

Except ... variables in dependency lines are substituted when the file
is read, and proj_wrap_c_FLAGS hasn't been defined at that point. I'll
change the compilation rules to move this into the actions.

Try r37929; I can't easily test it, as neither PROJ nor GDAL require
any -I switches on my system.

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

On 18/06/09 20:12, Glynn Clements wrote:

Moritz Lennert wrote:

In swig/python/Makefile, I see

proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)

but I don't really understand where this comes into play.

This should ensure that proj_wrap.c can find the PROJ and GDAL headers.

Yes, but what I meant is that I don't see where the proj_wrap_c_FLAGS
variable is read.

include/Make/Compile.make:

$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS) $($*_c_FLAGS) | $(OBJDIR)
  $(call compiler_c)

$* is the stem, i.e. the part of the name which the % matches, so if
the target is $(OBJDIR)/proj_wrap.c, $* is proj_wrap and $*_c_FLAGS is
proj_wrap_c_FLAGS.

Thanks and sorry, should have been able to find this myself...

Except ... variables in dependency lines are substituted when the file
is read, and proj_wrap_c_FLAGS hasn't been defined at that point. I'll
change the compilation rules to move this into the actions.

Try r37929; I can't easily test it, as neither PROJ nor GDAL require
any -I switches on my system.

Now it get's further, but fails with apparently the same problem at:

gcc
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-Wall -g -O2 -fPIC -I/usr/include/python2.5 -I/usr/include/python2.5
  -DPACKAGE=\""grasslibs"\"
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o
OBJ.i486-pc-linux-gnu/vector_wrap.o -c vector_wrap.c
In file included from
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/vect/digit.h:3,
                  from
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/Vect.h:4,
                  from vector_wrap.c:2731:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/vect/dig_structs.h:24:21:

error: ogr_api.h: No such file or directory
In file included from
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/vect/digit.h:3,
                  from
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/Vect.h:4,
                  from vector_wrap.c:2731:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/vect/dig_structs.h:183:

error: expected specifier-qualifier-list before 'OGRDataSourceH'
vector_wrap.c: In function '_wrap_Format_info_ogr_ds_set':
vector_wrap.c:18561: error: 'struct Format_info_ogr' has no member named
'ds'
[...]

Moritz

Moritz Lennert wrote:

>> Yes, but what I meant is that I don't see where the proj_wrap_c_FLAGS
>> variable is read.
>
> include/Make/Compile.make:
>
> $(OBJDIR)/%.o : %.c $(LOCAL_HEADERS) $(EXTRA_HEADERS) $($*_c_FLAGS) | $(OBJDIR)
> $(call compiler_c)
>
> $* is the stem, i.e. the part of the name which the % matches, so if
> the target is $(OBJDIR)/proj_wrap.c, $* is proj_wrap and $*_c_FLAGS is
> proj_wrap_c_FLAGS.

Thanks and sorry, should have been able to find this myself...

That's okay; it took me 5 minutes to find it, and I put it there :wink:

> Except ... variables in dependency lines are substituted when the file
> is read, and proj_wrap_c_FLAGS hasn't been defined at that point. I'll
> change the compilation rules to move this into the actions.
>
> Try r37929; I can't easily test it, as neither PROJ nor GDAL require
> any -I switches on my system.
>

Now it get's further, but fails with apparently the same problem at:

OBJ.i486-pc-linux-gnu/vector_wrap.o -c vector_wrap.c

error: ogr_api.h: No such file or directory

Er, right. It's using $(VECT_INC), which is always empty. It should be
using $(VECT_CFLAGS), which contains $(GDALCFLAGS). Try r37944.

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

I'm having the same problem again with today's svn trunk:

gcc -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -Wall -g -O2 -fPIC -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grasslibs"\" -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o OBJ.i486-pc-linux-gnu/find_vect.o -c find_vect.c
find_vect.c:22:21: error: ogr_api.h: Aucun fichier ou répertoire de ce type
find_vect.c: In function ‘find_ogr’:
find_vect.c:96: error: ‘OGRDataSourceH’ undeclared (first use in this function)
find_vect.c:96: error: (Each undeclared identifier is reported only once
find_vect.c:96: error: for each function it appears in.)
find_vect.c:96: error: expected ‘;’ before ‘Ogr_ds’
find_vect.c:100: warning: implicit declaration of function ‘OGRRegisterAll’
find_vect.c:103: error: ‘Ogr_ds’ undeclared (first use in this function)
find_vect.c:103: warning: implicit declaration of function ‘OGROpen’
make: *** [OBJ.i486-pc-linux-gnu/find_vect.o] Erreur 1

I can solve that with the following:

Index: lib/gis/Makefile

--- lib/gis/Makefile (révision 38619)
+++ lib/gis/Makefile (copie de travail)
@@ -4,7 +4,7 @@

  EXTRA_LIBS = $(DATETIMELIB) $(PTHREADLIBPATH) $(PTHREADLIB) \
    $(INTLLIB) $(MATHLIB) $(ZLIBLIBPATH) $(ZLIB) $(GDALLIBS)
-EXTRA_INC = $(ZLIBINCPATH) $(PTHREADINCPATH)
+EXTRA_INC = $(GDALCFLAGS) $(ZLIBINCPATH) $(PTHREADINCPATH)

  DATASRC = ellipse.table datum.table datumtransform.table FIPS.code state27 state83 projections

but am not sure that this is the correct approach.

Can someone tell me if it is ?

Moritz

Moritz Lennert wrote:

I'm having the same problem again with today's svn trunk:

gcc
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-Wall -g -O2 -fPIC -D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grasslibs"\"
   -I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o
OBJ.i486-pc-linux-gnu/find_vect.o -c find_vect.c
find_vect.c:22:21: error: ogr_api.h: Aucun fichier ou répertoire de ce type
find_vect.c: In function �find_ogr�:
find_vect.c:96: error: �OGRDataSourceH� undeclared (first use in this
function)
find_vect.c:96: error: (Each undeclared identifier is reported only once
find_vect.c:96: error: for each function it appears in.)
find_vect.c:96: error: expected �;� before �Ogr_ds�
find_vect.c:100: warning: implicit declaration of function �OGRRegisterAll�
find_vect.c:103: error: �Ogr_ds� undeclared (first use in this function)
find_vect.c:103: warning: implicit declaration of function �OGROpen�
make: *** [OBJ.i486-pc-linux-gnu/find_vect.o] Erreur 1

I can solve that with the following:

Index: lib/gis/Makefile

--- lib/gis/Makefile (révision 38619)
+++ lib/gis/Makefile (copie de travail)
@@ -4,7 +4,7 @@

  EXTRA_LIBS = $(DATETIMELIB) $(PTHREADLIBPATH) $(PTHREADLIB) \
    $(INTLLIB) $(MATHLIB) $(ZLIBLIBPATH) $(ZLIB) $(GDALLIBS)
-EXTRA_INC = $(ZLIBINCPATH) $(PTHREADINCPATH)
+EXTRA_INC = $(GDALCFLAGS) $(ZLIBINCPATH) $(PTHREADINCPATH)

  DATASRC = ellipse.table datum.table datumtransform.table FIPS.code
state27 state83 projections

but am not sure that this is the correct approach.

Can someone tell me if it is ?

The correct approach is to revert the portion of r38552 which applies
to lib/gis/find_vect.c, lib/gis/find_file.c, and lib/gis/Makefile.

lib/gis has no business calling OGR functions, or even linking against
OGR. If it's impossible to "find" a vector without them, then
find_vect.c should be removed altogether, and the functions moved into
the vector library.

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

Hi,

2009/8/6 Glynn Clements <glynn@gclements.plus.com>:

The correct approach is to revert the portion of r38552 which applies
to lib/gis/find_vect.c, lib/gis/find_file.c, and lib/gis/Makefile.

lib/gis has no business calling OGR functions, or even linking against
OGR. If it's impossible to "find" a vector without them, then
find_vect.c should be removed altogether, and the functions moved into
the vector library.

right, I reverted changes in r38719.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa