Old flex compile problems

334 views
Skip to first unread message

Tim King

unread,
Aug 5, 2010, 3:53:38 PM8/5/10
to stp-users
When trying to build STP from the svn repository (revision 967), I get
the following error message:
$make
...
make -C src/parser
make[1]: Entering directory `/u/tking/software/stp/src/parser'
flex -Cfe -olexCVC.cpp -Pcvc CVC.lex
flex: -Cf/-CF and %option yylineno are incompatible
make[1]: *** [lexCVC.cpp] Error 1

I "fixed" this by removing the "f" flag to flex:
$ svn diff src/parser/Makefile
Index: src/parser/Makefile
===================================================================
--- src/parser/Makefile (revision 967)
+++ src/parser/Makefile (working copy)
@@ -2,7 +2,7 @@
include $(TOP)/scripts/Makefile.common

#`From the flex manual>: -Cfe' is often a good compromise between
speed and size for production scanners.
-LEX=flex -Cfe
+LEX=flex -Ce
YACC=bison -d -y --debug -v

SRCS = lexCVC.cpp parseCVC.cpp parseSMT.cpp lexSMT.cpp LetMgr.cpp
parse2SMT.cpp lex2SMT.cpp

Unfortunately, STP still fails to link because to the *lex_destroy()
functions in src/main/main.cpp:
$make
...
g++ -O3 -g -DCORE -m32 -I../AST -DONLY_MSPACES -
DMSPACES -I../../src/sat/mtl -I../../src/sat/core -DEXT_HASH_MAP -Wno-
deprecated -I../../src/sat/mtl -lstdc++ main.o versionString.o
Globals.o -L../STPManager -lstpmgr -L../absrefine_counterexample -
labstractionrefinement -L../to-sat -ltosat -L../simplifier -
lsimplifier -L../printer -lprinter -L../AST -last -L../extlib-constbv -
lconstantbv -L../sat -lminisat -L../parser -lparser -L../extlib-abc -
labc -o stp
main.o: In function `main':
/u/tking/software/stp/src/main/main.cpp:467: undefined reference to
`smt2lex_destroy()'
/u/tking/software/stp/src/main/main.cpp:470: undefined reference to
`cvclex_destroy()'
/u/tking/software/stp/src/main/main.cpp:464: undefined reference to
`smtlex_destroy()'
collect2: ld returned 1 exit status
make[1]: *** [parser] Error 1

I can get the program to compile by commenting these lines out, but
that does not strike me as a terribly good compromise. Does pass
'make check' though.

The versions of flex I am currently stuck with are flex-2.5.4a-41.fc6
and flex-2.5.4a-33. These are the default Red Hat Enterprise 5 and 4
versions of flex. I am not sure if upgrading to a newer version would
fix my problems or not.

Cheers.

Stephen McCamant

unread,
Aug 5, 2010, 4:09:32 PM8/5/10
to stp-...@googlegroups.com
>>>>> "TK" == Tim King <timothy....@gmail.com> writes:

TK> When trying to build STP from the svn repository (revision 967), I
TK> get the following error message:

TK> flex -Cfe -olexCVC.cpp -Pcvc CVC.lex
TK> flex: -Cf/-CF and %option yylineno are incompatible

TK> I "fixed" this by removing the "f" flag to flex:
[snip patch]
TK> Unfortunately, STP still fails to link because to the *lex_destroy()
TK> functions in src/main/main.cpp:
TK> main.o: In function `main':
TK> /u/tking/software/stp/src/main/main.cpp:467: undefined reference to
TK> `smt2lex_destroy()'

TK> I can get the program to compile by commenting these lines out,
TK> but that does not strike me as a terribly good compromise. Does
TK> pass 'make check' though.

I'd say this is probably not a bad work-around. Not calling a
destructor sounds like it could be some sort of memory leak, but I
doubt that it is one that would be very noticeable in most
situations. (I don't think the lexer allocates much state, and you
generally only have one per program execution anyway.)

TK> The versions of flex I am currently stuck with are
TK> flex-2.5.4a-41.fc6 and flex-2.5.4a-33. These are the default Red
TK> Hat Enterprise 5 and 4 versions of flex. I am not sure if
TK> upgrading to a newer version would fix my problems or not.

I believe that the flex features that STP needs were added in version
2.5.20, released in September of 2002. So you should be OK with a
version newer than that. For some reason RedHat seems to like very old
versions of flex.

Hope this helps,

-- Stephen

Mark Tuttle

unread,
Mar 13, 2014, 5:06:13 PM3/13/14
to stp-...@googlegroups.com
I just grabbed the latest commit c210575455 from https://github.com/stp/stp and encountered myself this problem reported four years ago. Is this still the preferred work around? I'm using flex 2.5.4 and bison 2.7. Thanks. -Mark

> flex -Cfe -olexCVC.cpp -Pcvc CVC.lex
> flex: -Cf/-CF and %option yylineno are incompatible
>

> I "fixed" this by removing the "f" flag to flex:

> Unfortunately, STP still fails to link because to the *lex_destroy()
> functions in src/main/main.cpp:
> main.o: In function `main':


> main.cpp:467: undefined reference to `smt2lex_destroy()'

> main.cpp:470: undefined reference to `cvclex_destroy()'

Ryan Govostes

unread,
Mar 14, 2014, 8:20:18 PM3/14/14
to stp-...@googlegroups.com
I am not familiar with the problem or its workaround, but please file an issue on GitHub so we can track it.

Ryan



--

---
You received this message because you are subscribed to the Google Groups "stp-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stp-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
Ryan Govostes
rgov...@gmail.com

Stephen McCamant

unread,
Mar 17, 2014, 12:32:43 PM3/17/14
to stp-...@googlegroups.com
>>>>> "MT" == Mark Tuttle <markr...@gmail.com> writes:

MT> I just grabbed the latest commit c210575455 from
MT> https://github.com/stp/stp and encountered myself this problem
MT> reported four years ago. Is this still the preferred work around?
MT> I'm using flex 2.5.4 and bison 2.7. Thanks. -Mark

Make> flex -Cfe -olexCVC.cpp -Pcvc CVC.lex
Make> flex: -Cf/-CF and %option yylineno are incompatible
Make>
Make> I "fixed" this by removing the "f" flag to flex:

Make> Unfortunately, STP still fails to link because to the *lex_destroy()
Make> functions in src/main/main.cpp:
Make> main.o: In function `main':
Make> main.cpp:467: undefined reference to `smt2lex_destroy()'
Make> main.cpp:470: undefined reference to `cvclex_destroy()'
Make> main.cpp:464: undefined reference to `smtlex_destroy()'
Make> collect2: ld returned 1 exit status

I'm not aware of anything that has changed on this front since the
discussion 4 years ago. I can understand that seems like a long time
for a problem to persist, but I'm guessing that none of the regular
STP developers use a platform with such an old version of flex, so it
doesn't really come up. And I think we could also say that a
12-year-old version of flex seems so awfully old, we were hoping
people would just stop using it.

I think the recommended fix would be to use a more recent version of
flex. We could perhaps make the situation more user-friendly by adding
a version check to the build system. At the moment I'm not sure
there's even a check in advance that flex is available, though I'm not
up on all of the relevant CMake details; there seems to be a
"FindFLEX" module that has the capability but I can't tell whether
we're using it.

If by a workaround you mean something that doesn't involve getting a
newer version of flex, I think the suggestions from the previous
thread, of removing the "f" option and commenting out the calls to
*_destroy(), is the best of the known workarounds perhaps just by
virtue of nothing else having been suggested. If you notice something
else wrong with it, that might help prod interest in other possible
fixes.

Mark Tuttle

unread,
Mar 17, 2014, 12:46:33 PM3/17/14
to stp-...@googlegroups.com, mcca...@cs.umn.edu
Thanks, Stephen, I did find later versions of flex and bison built in my environment, and I did confirm this morning that the problem is now resolved, I just hadn't gotten a chance to post to this group that the issue is now closed.  -Mark
Reply all
Reply to author
Forward
0 new messages