[Bro] Strange Bro build problem with yacc/bison

Christian Kreibich christian at whoop.org
Mon Dec 4 17:19:21 PST 2006

On Mon, 2006-12-04 at 11:44 -0700, frenzy at frenzy.org wrote:
> I am getting this on a FreeBSD 5.4 system also. It seems that
> make_parser.pl is not getting called to interpret the parse.y file.
> If I run 'make_parser.pl byacc' manually, then the build completes.

Robin and I just stared at this for a while longer. What's happening is
that when the error occurs, the build re-generates parse.cc, even on the
initial build after unpacking the tarball. This is not what we intended.
It does not seem to be a flaw of the Makefile, but stem from the fact
that on some platforms, this rule...

> broparse.h parse.cc: parse.y
>         $(YACC) $(YFLAGS) parse.y
>         @sed '/extern char.*getenv/d;s/yylex/brolex/' <y.tab.c >parse.cc
>         @mv y.tab.h broparse.h
>         @rm y.tab.c

... is triggered despite the fact that broparse.h, parse.cc, and parse.y
all have the same timestamp. Could you double-check that this is the
case on your tree, by unpacking the tarball and doing a

$ ls -la broparse.h parse.y parse.cc
-rw-r--r--    1 kreibich networks     7396 Oct  5 13:36 broparse.h
-rw-r--r--    1 kreibich networks   134265 Oct  5 13:36 parse.cc
-r--r--r--    1 kreibich networks    24651 Oct  5 13:36 parse.y


What happens is that make determines that broparse.h/parse.cc need to be
rebuilt, but it uses the parse.y that's shipped with the tarball, and
not a new one generated from parse.in that'd have the yacc-hack applied
to it via make_parser.pl. So you end up with a broken parse.cc.

We'll think of a way to ensure that the parse.y is always compatible
with the local bison/yacc (if available).


More information about the Bro mailing list