[GRASS-dev] installing v.mapcalc fails

I am trying to install v.mapcalc through g.extension, but I am getting the following error message:

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or

directory

  #include "v.mapcalc.tab.h"

                            ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Any idea?

Paulo

On 11/09/15 10:56, Paulo van Breugel wrote:

I am trying to install v.mapcalc through g.extension, but I am getting
the following error message:

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or

directory

   #include "v.mapcalc.tab.h"

                             ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Any idea?

Well, the file does not exist. I don't know if it ever did (I can't find it in the older versions in trac). Could you just try without that include line ?

Moritz

On 11-09-15 12:31, Moritz Lennert wrote:

On 11/09/15 10:56, Paulo van Breugel wrote:

I am trying to install v.mapcalc through g.extension, but I am getting
the following error message:

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or

directory

   #include "v.mapcalc.tab.h"

                             ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Any idea?

Well, the file does not exist. I don't know if it ever did (I can't find it in the older versions in trac). Could you just try without that include line ?

I only see it mentioned in the make file in the line

.INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

I remove it from there?

Moritz

On 11/09/15 12:55, Paulo van Breugel wrote:

On 11-09-15 12:31, Moritz Lennert wrote:

On 11/09/15 10:56, Paulo van Breugel wrote:

I am trying to install v.mapcalc through g.extension, but I am getting
the following error message:

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or

directory

    #include "v.mapcalc.tab.h"

                              ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Any idea?

Well, the file does not exist. I don't know if it ever did (I can't
find it in the older versions in trac). Could you just try without
that include line ?

I only see it mentioned in the make file in the line

.INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

I remove it from there?

No, actually, looking closer at this, the file should be created during compilation, but isn't.

If you run bison -d v.mapcalc.y in the directory the file is created and compilation works. So it needs some Makefile magic to provoke the creation of the file before the compilation of the rest.

The following patch seems to do the trick, but I'm not familiar enough with make to judge whether this is the right solution:

Index: Makefile

--- Makefile (révision 66168)
+++ Makefile (copie de travail)
@@ -13,6 +13,8 @@

  default: cmd

+$(OBJDIR)/v.mapcalc.tab.o: v.mapcalc.tab.h
+
  yylex.c: v.mapcalc.tab.h

  .INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

On Fri, Sep 11, 2015 at 4:56 AM, Paulo van Breugel <p.vanbreugel@gmail.com>
wrote:

I am trying to install v.mapcalc through g.extension, but I am getting the
following error message:

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Have you tried t.vect.algebra module in trunk (7.1)? I'm not sure if it
works on single vectors but it supports the following operations on a
single vector: AND, OR, DISJOINT OR, XOR, NOT, buffer_p, buffer_l, buffer_a.

https://grass.osgeo.org/grass71/manuals/t.vect.algebra.html#spatial-vector-operators

On 11 September 2015 15:46:41 CEST, Vaclav Petras <wenzeslaus@gmail.com> wrote:

On Fri, Sep 11, 2015 at 4:56 AM, Paulo van Breugel
<p.vanbreugel@gmail.com>
wrote:

I am trying to install v.mapcalc through g.extension, but I am

getting the

following error message:

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Have you tried t.vect.algebra module in trunk (7.1)? I'm not sure if it
works on single vectors but it supports the following operations on a
single vector: AND, OR, DISJOINT OR, XOR, NOT, buffer_p, buffer_l,
buffer_a.

I haven't, but I'll have a look. Thanks.

https://grass.osgeo.org/grass71/manuals/t.vect.algebra.html#spatial-vector-operators

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

On Fri, Sep 11, 2015 at 2:40 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

The following patch seems to do the trick, but I'm not familiar enough with
make to judge whether this is the right solution:

Index: Makefile

--- Makefile (révision 66168)
+++ Makefile (copie de travail)
@@ -13,6 +13,8 @@

default: cmd

+$(OBJDIR)/v.mapcalc.tab.o: v.mapcalc.tab.h
+
yylex.c: v.mapcalc.tab.h

.INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

For the record: submitted in r66361 (otherwise we'll never figure it out).
Paulo, please test.

Markus

On Mon, Sep 28, 2015 at 10:48 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Fri, Sep 11, 2015 at 2:40 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:
>
> The following patch seems to do the trick, but I'm not familiar enough
with
> make to judge whether this is the right solution:
>
> Index: Makefile
> ===================================================================
> --- Makefile (révision 66168)
> +++ Makefile (copie de travail)
> @@ -13,6 +13,8 @@
>
> default: cmd
>
> +$(OBJDIR)/v.mapcalc.tab.o: v.mapcalc.tab.h
> +
> yylex.c: v.mapcalc.tab.h
>
> .INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

For the record: submitted in r66361 (otherwise we'll never figure it out).
Paulo, please test.

I'll give it a try in a few days time

Markus

On 28-09-15 10:48, Markus Neteler wrote:

On Fri, Sep 11, 2015 at 2:40 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

The following patch seems to do the trick, but I'm not familiar enough with
make to judge whether this is the right solution:

Index: Makefile

--- Makefile (révision 66168)
+++ Makefile (copie de travail)
@@ -13,6 +13,8 @@

  default: cmd

+$(OBJDIR)/v.mapcalc.tab.o: v.mapcalc.tab.h
+
  yylex.c: v.mapcalc.tab.h

  .INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

For the record: submitted in r66361 (otherwise we'll never figure it out).
Paulo, please test.

Tried to install it using g.extension, but still fails:

GRASS 7.1.svn (latlon):~ > g.extension v.mapcalc

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

  #include "v.mapcalc.tab.h"

                            ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Markus

On 29/09/15 11:11, Paulo van Breugel wrote:

On 28-09-15 10:48, Markus Neteler wrote:

On Fri, Sep 11, 2015 at 2:40 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

The following patch seems to do the trick, but I'm not familiar enough with
make to judge whether this is the right solution:

Index: Makefile

--- Makefile (révision 66168)
+++ Makefile (copie de travail)
@@ -13,6 +13,8 @@

   default: cmd

+$(OBJDIR)/v.mapcalc.tab.o: v.mapcalc.tab.h
+
   yylex.c: v.mapcalc.tab.h

   .INTERMEDIATE: v.mapcalc.tab.c v.mapcalc.tab.h v.mapcalc.output

For the record: submitted in r66361 (otherwise we'll never figure it out).
Paulo, please test.

Tried to install it using g.extension, but still fails:

GRASS 7.1.svn (latlon):~ > g.extension v.mapcalc

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

   #include "v.mapcalc.tab.h"

                             ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Glynn, can you help us on this ? We need to find the correct Makefile for the v.mapcalc addon [1]

Moritz

[1] https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.mapcalc

On Tue, Sep 29, 2015 at 11:11 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On 28-09-15 10:48, Markus Neteler wrote:

...

GRASS 7.1.svn (latlon):~ > g.extension v.mapcalc

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

#include "v.mapcalc.tab.h"

                           ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Please try r66377.

Markus

On 29/09/15 13:14, Markus Neteler wrote:

On Tue, Sep 29, 2015 at 11:11 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On 28-09-15 10:48, Markus Neteler wrote:

...

GRASS 7.1.svn (latlon):~ > g.extension v.mapcalc

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

  #include "v.mapcalc.tab.h"

                            ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Please try r66377.

I still get the same error.

Moritz

On 29-09-15 14:12, Moritz Lennert wrote:

On 29/09/15 13:14, Markus Neteler wrote:

On Tue, Sep 29, 2015 at 11:11 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On 28-09-15 10:48, Markus Neteler wrote:

...

GRASS 7.1.svn (latlon):~ > g.extension v.mapcalc

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

  #include "v.mapcalc.tab.h"

                            ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Please try r66377.

I still get the same error.

Yes, for me too, still the same error

Moritz

Moritz Lennert wrote:

> yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory
>
> #include "v.mapcalc.tab.h"
>
> ^
>
> compilation terminated.
>
> make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1
>
> ERROR: Compilation failed, sorry. Please check above error messages.

Glynn, can you help us on this ? We need to find the correct Makefile
for the v.mapcalc addon [1]

That header is generated by yacc (or byacc, bison, etc) via a pattern
rule in include/Make/Compile.make:

  %.output %.tab.h %.tab.c: %.y
    $(YACC) -b$* $(YFLAGS) $<

The problem with v.mapcalc is that it tries to compile yylex.c before
v.mapcalc.tab.h has been generated, which fails. It requires:

  -yylex.c: v.mapcalc.tab.h
  +$(OBJDIR)/yylex.o: v.mapcalc.tab.h

The header is a dependency of the object file; the source file doesn't
have dependencies (it's a source file, not generated).

Committed in r66392.

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

On 01/10/15 12:38, Glynn Clements wrote:

Moritz Lennert wrote:

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

    #include "v.mapcalc.tab.h"

                              ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Glynn, can you help us on this ? We need to find the correct Makefile
for the v.mapcalc addon [1]

That header is generated by yacc (or byacc, bison, etc) via a pattern
rule in include/Make/Compile.make:

  %.output %.tab.h %.tab.c: %.y
    $(YACC) -b$* $(YFLAGS) $<

The problem with v.mapcalc is that it tries to compile yylex.c before
v.mapcalc.tab.h has been generated, which fails. It requires:

  -yylex.c: v.mapcalc.tab.h
  +$(OBJDIR)/yylex.o: v.mapcalc.tab.h

The header is a dependency of the object file; the source file doesn't
have dependencies (it's a source file, not generated).

Committed in r66392.

Thanks for the fix and the explanation ! It works for me now.

Moritz

On 02-10-15 10:50, Moritz Lennert wrote:

On 01/10/15 12:38, Glynn Clements wrote:

Moritz Lennert wrote:

yylex.c:9:27: fatal error: v.mapcalc.tab.h: No such file or directory

    #include "v.mapcalc.tab.h"

                              ^

compilation terminated.

make: *** [OBJ.x86_64-unknown-linux-gnu/yylex.o] Error 1

ERROR: Compilation failed, sorry. Please check above error messages.

Glynn, can you help us on this ? We need to find the correct Makefile
for the v.mapcalc addon [1]

That header is generated by yacc (or byacc, bison, etc) via a pattern
rule in include/Make/Compile.make:

    %.output %.tab.h %.tab.c: %.y
        $(YACC) -b$* $(YFLAGS) $<

The problem with v.mapcalc is that it tries to compile yylex.c before
v.mapcalc.tab.h has been generated, which fails. It requires:

    -yylex.c: v.mapcalc.tab.h
    +$(OBJDIR)/yylex.o: v.mapcalc.tab.h

The header is a dependency of the object file; the source file doesn't
have dependencies (it's a source file, not generated).

Committed in r66392.

Thanks for the fix and the explanation ! It works for me now.

Sorry for the late follow up. The add-on installs now. When trying to run it, however, nothing happens. I don't know if it has anything to do with the error/warning message I got when installing (below)?

Fetching <v.mapcalc> from GRASS GIS Addons repository (be patient)...

Compiling...

yylex.c: In function ‘yylex’:

yylex.c:32:7: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]

   scanf("%lf", &yylval.dbl);

        ^

Installing...

Updating addons metadata file...

WARNING: No addons metadata available. Addons metadata file not updated.

Installation of <v.mapcalc> successfully finished

The 'no addons metadata available' is something I see more often, and is probably a problem at the server side if I understood well from other email treads.

Moritz

On Fri, Oct 9, 2015 at 9:54 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
...

Sorry for the late follow up. The add-on installs now. When trying to run
it, however, nothing happens.

It does not have a parser (yet?), so I suppose it reads from stdin.

Markus

On Fri, Oct 9, 2015 at 12:30 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Fri, Oct 9, 2015 at 9:54 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
...
> Sorry for the late follow up. The add-on installs now. When trying to run
> it, however, nothing happens.

It does not have a parser (yet?), so I suppose it reads from stdin.

OK, thanks for the clarification

Markus

Markus Neteler wrote:

<p.vanbreugel@gmail.com> wrote:
...
> Sorry for the late follow up. The add-on installs now. When trying to run
> it, however, nothing happens.

It does not have a parser (yet?), so I suppose it reads from stdin.

Yes.

But it doesn't have any code to read or write GRASS vectors, either.
v.mapcalc appears to be a work-in-progress which hasn't actually made
noticeable progress since it was added.

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

On Mon, Oct 12, 2015 at 6:24 AM, Glynn Clements <glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

<p.vanbreugel@gmail.com> wrote:

Sorry for the late follow up. The add-on installs now. When trying to run
it, however, nothing happens.

It does not have a parser (yet?), so I suppose it reads from stdin.

Yes.

But it doesn’t have any code to read or write GRASS vectors, either.
v.mapcalc appears to be a work-in-progress which hasn’t actually made
noticeable progress since it was added.

Then I suggest to remove it from the Makefile parent directory and also disable it in the addons build scripts if there is something more needed than r66406 [1] which is blacklisting it somehow already. It does not fulfill what user would expect (at least some functionality). Those who want to continue development will get it through svn.

I’m not sure happened [2] with the v.mapcalc implemented as a test case in GSoC [3] and if the functionality can be still used. But this seems like a good alternative to the code in addons.

Vaclav

[1] https://trac.osgeo.org/grass/changeset/66406
[2] https://lists.osgeo.org/pipermail/grass-dev/2013-October/065908.html
[3] https://grasswiki.osgeo.org/wiki/GRASS_GSoC_2013_Temporal_GIS_Algebra_for_raster_and_vector_data_in_GRASS#v.mapcalc