Opened 13 years ago

Closed 13 years ago

#636 closed defect (fixed)

Compile error (lwin_wkt.c)

Reported by: jorgearevalo Owned by: pramsey
Priority: blocker Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc: jorge.arevalo@…

Description

Hello,

I'm getting a compile error with the last revision from SVN trunk (r6091):

lwin_wkt.c:2:28: error: lwin_wkt_parse.h: No such file or directory

The error is related with this last changeset: http://trac.osgeo.org/postgis/changeset/6091#file7

Anyone else?

My enviroment: Ubuntu 9.10, gcc 4.4.1, PostgreSQL 8.4.5, GEOS 3.3.0, Proj 4.4.7. libxml 2.2.5, bison 2.4.1

Attachments (2)

postgis-liblwgeom-makefile.patch (1.4 KB ) - added by mcayland 13 years ago.
lwin_wkt.zip (29.6 KB ) - added by robe 13 years ago.
generated from yacc and flex

Download all attachments as: .zip

Change History (24)

comment:1 by mcayland, 13 years ago

+1 - it's broken for me too.

gcc -g -O2 -fPIC -DPIC -Wall -Wmissing-prototypes -c -o lwin_wkt.o lwin_wkt.c lwin_wkt.c:2:28: error: lwin_wkt_parse.h: No such file or directory

I suspect Paul either forgot to "svn add" a file, or it's a simple typo.

comment:2 by cgsbob, 13 years ago

I got the same error. The way I fixed it is by doing this:

cd liblwgeom
make lwin_wkt_parse.h
cd ..
make

comment:3 by pramsey, 13 years ago

Makefile.in should be fixed at r6092. Don't forget to run ./configure

comment:4 by mcayland, 13 years ago

Nope it's still broken for me :(

It looks as if the issue here is that the lwin_wkt* files need to be rearranged into a slightly different order for compilation to work, and also the bison generation dependency needs to be on the .c file and not the .o file.

The attached patch fixes the issues for me (as well as getting "make clean" to clean up the extra files too). Paul, can you review and commit if it works for you?

by mcayland, 13 years ago

comment:5 by jorgearevalo, 13 years ago

+1. The patch works for me

comment:6 by jorgearevalo, 13 years ago

Cc: jorge.arevalo@… added

comment:7 by pramsey, 13 years ago

Resolution: fixed
Status: newclosed

OK, patch applied at r6100. Note you might need to make clean before you make. My test was to rm lwin_wkt_parse.h and that case is not handled, but it's a degenerate situation. Das is goot.

comment:8 by robe, 13 years ago

Resolution: fixed
Status: closedreopened

Paul — I'll have to check again but even with Mark's patch Ming was not happy with your yacc. I thought maybe it was because my flex and bison were kind of old.

I was running bison 2.0 I think and I upgraded to 2.5.4.

I forget my flex version, but it didn't seem to like the —case-sensitive 9compalined of - is invalid command). I changed to -i (which stopped that complaining) but I guess I was getting also an error earlier in bison since flex complained the other file was not available. Anyway I'll put up some proper detail later and mark as a non-issue if the problem went away with your last patch. Just wanted to put my foot here before I forgot about it.

Which flex and bison is everyone running by chance?

comment:9 by jorgearevalo, 13 years ago

It's working fine for me. I'm using Flex 2.5.35 and Bison 2.4.1

comment:10 by pramsey, 13 years ago

flex 2.5.35 and bison (GNU Bison) 2.3

If changing —case-insensitive to -i is all you have to do, do that.

In fact, I just did that at r6104

comment:11 by robe, 13 years ago

Paul,

Thanks for the change but unfortunately that is not enough. With my bison 2.0 or 2.5 I am still left with this error. I am running flex 2.5.4.

I have to say I'm compiling against PostgreSQL 9.1 Alpha but I can't see why that would make a difference.

bison -y -o lwin_wkt_parse.c -d lwin_wkt_parse.y
gcc -g -O2  -DDLL_EXPORT -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkt_parse.o lwin_wkt_parse.c
In file included from lwin_wkt_parse.y:16:
lwin_wkt.h:50:54: warning: no newline at end of file
flex -i -o lwin_wkt_lex.c lwin_wkt_lex.l
C:\MinGW\bin\flex.exe: can't open lwin_wkt_lex.c
make[1]: *** [lwin_wkt_lex.c] Error 1
make[1]: Leaving directory `/c/projects/PostGIS/trunk/liblwgeom'
make: *** [liblwgeom] Error 2
make -C liblwgeom 
make[1]: Entering directory `/c/projects/PostGIS/trunk/liblwgeom'
flex -i -o lwin_wkt_lex.c lwin_wkt_lex.l
C:\MinGW\bin\flex.exe: can't open lwin_wkt_lex.c
make[1]: *** [lwin_wkt_lex.c] Error 1

comment:12 by pramsey, 13 years ago

Looks like it doesn't respect the -o flag. Try a couple variants:

flex -o lwin_wkt_lex.c -i lwin_wkt_lex.l
flex --outfile=lwin_wkt_lex.c -i lwin_wkt_lex.l

See if it likes those.

comment:13 by robe, 13 years ago

Nope nope,

but this works: flex -olwin_wkt_lex.c lwin_wkt_lex.l

which gets me a bit further - I wonder if the other errors are similar issue.

flex -i -olwin_wkt_lex.c lwin_wkt_lex.l
gcc -g -O2  -DDLL_EXPORT -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkt_lex.o lwin_wkt_lex.c
lwin_wkt_lex.c:681: warning: no previous prototype for 'wkt_yylex'
lwin_wkt_lex.c: In function `wkt_yylex':
lwin_wkt_lex.c:773: error: `yylineno' undeclared (first use in this function)
lwin_wkt_lex.c:773: error: (Each undeclared identifier is reported only once
lwin_wkt_lex.c:773: error: for each function it appears in.)
make[1]: *** [lwin_wkt_lex.o] Error 1
make[1]: Leaving directory `/c/projects/PostGIS/trunk/liblwgeom'
make: *** [liblwgeom] Error 2
make -C liblwgeom 
make[1]: Entering directory `/c/projects/PostGIS/trunk/liblwgeom'
gcc -g -O2  -DDLL_EXPORT -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkt_lex.o lwin_wkt_lex.c
lwin_wkt_lex.c:681: warning: no previous prototype for 'wkt_yylex'
lwin_wkt_lex.c: In function `wkt_yylex':
lwin_wkt_lex.c:773: error: `yylineno' undeclared (first use in this function)
lwin_wkt_lex.c:773: error: (Each undeclared identifier is reported only once
lwin_wkt_lex.c:773: error: for each function it appears in.)
make[1]: *** [lwin_wkt_lex.o] Error 1
make[1]: Leaving directory `/c/projects/PostGIS/trunk/liblwgeom'

comment:14 by pramsey, 13 years ago

Our previous bison and flex outputs were committed to the repo to avoid this kind of version churn, perhaps we should just do that. It's a shame to do it right now though, because in the midst of development they are going to be changing a lot.

comment:15 by robe, 13 years ago

I wouldn't be too upset if it were just MingW, but you have displeased our butler Hudson as well and he's having trouble sending email (Kevin maybe you should check on the email issue).

bison -y -o lwin_wkt_parse.c -d lwin_wkt_parse.y
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkt_parse.o lwin_wkt_parse.c
In file included from lwin_wkt_parse.y:16:
lwin_wkt.h:50:54: warning: no newline at end of file
flex -i -o lwin_wkt_lex.c lwin_wkt_lex.l
flex: can't open lwin_wkt_lex.c
make[1]: *** [lwin_wkt_lex.c] Error 1
make[1]: Leaving directory `/var/home/buildbot/opt/hudson/jobs/PostGIS-trunk-build/workspace/src/liblwgeom'
make: *** [liblwgeom] Error 2

ERROR: Could not connect to SMTP host: 192.168.50.200, port: 25
javax.mail.MessagingException: Could not connect to SMTP host: 192.168.50.200, port: 25;
  nested exception is:
	java.net.NoRouteToHostException: No route to host
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
	at javax.mail.Service.connect(Service.java:275)
	at javax.mail.Service.connect(Service.java:156)
	at javax.mail.Service.connect(Service.java:105)
	at javax.mail.Transport.send0(Transport.java:168)
	at javax.mail.Transport.send(Transport.java:98)
	at hudson.tasks.MailSender.execute(MailSender.java:108)
	at hudson.tasks.Mailer.perform(Mailer.java:112)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601)
	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:580)
	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:558)
	at hudson.model.Build$RunnerImpl.post2(Build.java:158)
	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
	at hudson.model.Run.run(Run.java:1264)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:122)
Caused by: java.net.NoRouteToHostException: No route to host
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:381)
	at java.net.Socket.connect(Socket.java:537)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:230)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
	... 18 more
Notifying upstream projects of job completion
Finished: FAILURE

comment:16 by pramsey, 13 years ago

Well, I have changed the call to match the one you found worked, but that won't fix the fact that you still can't compile what it's outputting, and I don't know how to fix that one. I can commit the generated files, that might help?

comment:17 by mcayland, 13 years ago

IIRC from reworking the Makefiles for PGXS, the key to making older versions of flex read the filename from the command line correctly is to wrap the filename in apostrophes.

So I would try changing liblwgeom/Makefile.in from:

lwin_wkt_parse.c: lwin_wkt_parse.y

$(YACC) -o$@ -d $

to:

lwin_wkt_parse.c: lwin_wkt_parse.y

$(YACC) -o'$@' -d $

as per the existing parser Makefile rule.

comment:18 by pramsey, 13 years ago

OK, made that slight tweak to Makefile.in at r6111. Wondering if that will solve the compilation fail issue, seems unlikely…

comment:19 by robe, 13 years ago

Paul,

Haven't checked again, but Hudson is having the same issues I had after I manually fixed the flex line

  PostGIS is now configured for i686-redhat-linux-gnu

 -------------- Compiler Info ------------- 
  C compiler:           gcc -g -O2
  C++ compiler:         g++ -g -O2

 -------------- Dependencies -------------- 
  GEOS config:          /var/home/buildbot/opt/geos/3.2.0/bin/geos-config
  GEOS version:         3.2.0
  PostgreSQL config:    /var/home/buildbot/opt/pgsql/8.3/bin/pg_config
  PostgreSQL version:   PostgreSQL 8.3.7
  PROJ4 version:        46
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.6.26
  PostGIS debug level:  0

 -------- Documentation Generation -------- 
  xsltproc:             /usr/bin/xsltproc
  xsl style sheets:     /usr/share/sgml/docbook/xsl-stylesheets
  dblatex:              /usr/bin/dblatex
  convert:              /usr/bin/convert

++ grep MAJOR Version.config
++ cut -f2 -d=
+ POSTGIS_MAJOR_VERSION=2
++ grep MINOR Version.config
++ cut -f2 -d=
+ POSTGIS_MINOR_VERSION=0
++ grep MICRO Version.config
++ cut -f2 -d=
+ POSTGIS_MICRO_VERSION=0SVN
+ POSTGIS_VERSION=2.0.0SVN
+ make
make -C liblwgeom 
make[1]: Entering directory `/var/home/buildbot/opt/hudson/jobs/PostGIS-trunk-build/workspace/src/liblwgeom'
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o stringbuffer.o stringbuffer.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o measures.o measures.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o measures3d.o measures3d.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o box2d.o box2d.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o ptarray.o ptarray.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgeom_api.o lwgeom_api.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgeom.o lwgeom.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwpoint.o lwpoint.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwline.o lwline.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwpoly.o lwpoly.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwtriangle.o lwtriangle.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmpoint.o lwmpoint.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmline.o lwmline.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmpoly.o lwmpoly.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwcollection.o lwcollection.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwcircstring.o lwcircstring.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwcompound.o lwcompound.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwcurvepoly.o lwcurvepoly.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmcurve.o lwmcurve.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmsurface.o lwmsurface.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwpsurface.o lwpsurface.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwtin.o lwtin.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwout_wkb.o lwout_wkb.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkb.o lwin_wkb.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwout_wkt.o lwout_wkt.c
bison -y -o'lwin_wkt_parse.c' -d lwin_wkt_parse.y
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkt_parse.o lwin_wkt_parse.c
In file included from lwin_wkt_parse.y:16:
lwin_wkt.h:54:57: warning: no newline at end of file
flex -o'lwin_wkt_lex.c' -i lwin_wkt_lex.l
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwin_wkt_lex.o lwin_wkt_lex.c
In file included from lwin_wkt_lex.l:7:
lwin_wkt.h:54:57: warning: no newline at end of file
lwin_wkt_lex.c:690: warning: no previous prototype for ‘wkt_yylex’
lwin_wkt_lex.c: In function ‘wkt_yylex’:
lwin_wkt_lex.c:782: error: ‘yylineno’ undeclared (first use in this function)
lwin_wkt_lex.c:782: error: (Each undeclared identifier is reported only once
lwin_wkt_lex.c:782: error: for each function it appears in.)
make[1]: *** [lwin_wkt_lex.o] Error 1
make[1]: Leaving directory `/var/home/buildbot/opt/hudson/jobs/PostGIS-trunk-build/workspace/src/liblwgeom'
make: *** [liblwgeom] Error 2

I'm beginning to wonder if its just the order of the includes. Last I checked my build was creating these files (I even tried to upgrade my bison to the same version 2.4.2 — though that was a royal pain it finally took) and it didn't help the situation.

comment:20 by mcayland, 13 years ago

Regina,

Any chance you could attach the generated lwin_wkt_lex.c and lwin_wkt_parse.c files being generated by your build to this ticket so that we can take a look and figure out why the build fails?

by robe, 13 years ago

Attachment: lwin_wkt.zip added

generated from yacc and flex

comment:21 by robe, 13 years ago

Okay these should be right since they were from my last failed compile and haven't svn up yet.

comment:22 by pramsey, 13 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.