Opened 20 years ago

Closed 20 years ago

#975 closed defect (fixed)

Build problems with current cvs version on debian sarge

Reported by: mapserver@… Owned by: mapserverbugs
Priority: high Milestone: 4.4 release
Component: Build Problems Version: 4.3
Severity: normal Keywords:
Cc: m.spring@…, sgillies@…

Description

according to the 4.4 Release Plan
(http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?ReleasePlan44) i fill a bug report
on this. I reported a compiling error
(http://lists.gis.umn.edu/pipermail/mapserver-dev/2004-July/001214.html)
with the current cvs version in july which persist till today. This behaviour
was confirmed by Markus Spring
(http://lists.gis.umn.edu/pipermail/mapserver-dev/2004-July/001222.html)
What can i do to get a successful build? Do you need any further information?
Thanks
Nicol

Change History (9)

comment:1 by mapserver@…, 20 years ago

Milestone: 4.4 release

comment:2 by dmorissette, 20 years ago

Status: newassigned
Unfortunately I do not have any debian system to reproduce this and I have never
seen this error anywhere else.

Does this error still happen if you get the source package that includes the
pregenerated maplexer and mapparser files? I'd like to find out whether this is
a flex/bison issue or a compiler issue.

comment:3 by dmorissette, 20 years ago

Here is the -dev list email that was referred to above:
----------------------
Hi Developers,

i got the following compiling error with the current cvs version on my
testing (sarge) Debian box when i did a simple ./configure -> make

gcc -c -O2  -Wall -DIGNORE_MISSING_DATA -DNEED_STRLCAT  -DUSE_EPPL    
-DUSE_TIFF -DUSE_JPEG -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP
-DUSE_GD_FT         -I/usr/local/include               maplexer.c -o
maplexer.o
maplexer.l:17: error: redefinition of `msyylineno'
maplexer.c:335: error: `msyylineno' previously defined here
maplexer.l: In Funktion »lexer_cleanup«:
maplexer.l:25: error: `yy_current_buffer' undeclared (first use in this
function)
maplexer.l:25: error: (Each undeclared identifier is reported only once
maplexer.l:25: error: for each function it appears in.)
make: *** [maplexer.o] Fehler 1

What do i have to change to get ride of this error message?
Here are my environment:

gcc --version
gcc (GCC) 3.3.4 (Debian 1:3.3.4-3)

flex --version
flex 2.5.31

bison --version
bison (GNU Bison) 1.875a

Thank you very much for your help
Nicol


comment:4 by mapserver@…, 20 years ago

Hi Daniel, 
please excuse my ignorance. I'am not sure what you mean with 'pregenerated
maplexer and mapparser files'? Where can i find these files? The sources of the
official releases like ms 4.2.3 compiles fine on the same machine. Is it that
what you mean?
Nicol

comment:5 by dmorissette, 20 years ago

Yes this is what I meant. maplexer.c and mapparser.[ch] are pregenerated and
included in the source package for each release. However when you get source
from CVS they are not there yet: they need to be generated from maplexer.l and
mapparser.y by flex/bison.

So this seems to indicate that the problem would be related to the flex/bison
versions on this platform.

comment:6 by mapserver@…, 20 years ago

I checkout out the sources with cvs update -r rel-4-4-0-beta1 and found that
MapServer 4.4.0-beta1 has the same problem.

comment:7 by dmorissette, 20 years ago

Cc: sgillies@… steve.lime@… warmerdam@… added
That's to be expected since the CVS source doesn't include the generated parser
files as I explained above.

Adding other developers to the CC in the hope that one of them would have access
to a debian-sarge system to troubleshoot this.

comment:8 by dmorissette, 20 years ago

Looking into this now.

comment:9 by dmorissette, 20 years ago

Resolution: fixed
Status: assignedclosed
Fixed in 4.3 CVS. 

Flex 2.5.4 seems to be by far the most popular version and that's what
maplexer.l is written for. Debian sarge runs flex 2.5.31 in which a few things
have changed in a backwards-incompatible way (or anyway not compatible with our
maplexer.l).

We had to do the following two changes to maplexer.l to support both 2.5.4 and
more recent versions (e.g. 2.5.31). I think the comments in the code are
self-explanatory:

diff -u -r1.84 -r1.86
--- maplexer.l  4 Oct 2004 22:01:31 -0000       1.84
+++ maplexer.l  29 Oct 2004 02:55:45 -0000      1.86
@@ -13,20 +13,35 @@
 #include "mapsymbol.h"
 #include "mapparser.h"
  
-double msyynumber;
+/* msyylineno is required for flex 2.5.4 and older, but is already defined by
+ * flex 2.5.31 (bug 975).
+ * Unfortunately there is no clean way to differenciate the two versions,
+ * so we use the symbol YY_CURRENT_BUFFER_LVALUE to base our test since it
+ * was not present in 2.5.4 and is present in 2.5.31. Hopefully that won't
+ * put us in trouble with other versions. If that happens then we can
+ * switch to using autoconf to detect the version.
+ */
+#ifndef YY_CURRENT_BUFFER_LVALUE
 int msyylineno = 1;
+#endif
  
+double msyynumber;
 int msyystate=0;
 char *msyystring=NULL;
  
 int msyyreturncomments = 0;
  
 void lexer_cleanup() {
+#ifndef YY_CURRENT_BUFFER_LVALUE
+    /* yy_current_buffer was there only in older versions (e.g. 2.5.4)
+     * but is gone in newer versions (e.g. 2.5.31)
+     */
     if( yy_current_buffer != NULL )
     {
         yy_delete_buffer( yy_current_buffer );
         yy_current_buffer = 0;
     }
+#endif
 }
 %}
  
Note: See TracTickets for help on using tickets.