tbm / test

0 stars 0 forks source link

make build error: "invalid directive: `%precedence'" #93

Closed tbm closed 8 years ago

tbm commented 8 years ago

Original report by Aaron Bull Schaefer (Bitbucket: elasticdog, GitHub: elasticdog).


I pulled the most recent beancount and ran the python3 setup install just fine, but was warned that "The Beancount parser C extension module is out-of-date." when trying a bean-check. Trying to rebuild the extension, I'm running across this error:

$ make build
bison --report=itemset --verbose -o src/python/beancount/parser/grammar.c src/python/beancount/parser/grammar.y
src/python/beancount/parser/grammar.y:236.1-11: invalid directive: `%precedence'
make: *** [src/python/beancount/parser/grammar.h] Error 1

Using hg bisect, it looks like this was the first bad revision (from just a couple of days ago):

The first bad revision is:
changeset:   3398:eb69edcfaf1f
branch:      remove_position
user:        Martin Blais <blais@furius.ca>
date:        Sun Dec 13 18:04:31 2015 -0500
summary:     Removed the old Position implementation, replaced it by the newer (units,cost) representation.
tbm commented 8 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


This makes little sense to me. Nothing changed in the parser at that version.

Are you using bison-3.x? What's your version of Bison and Flex?

#!bash

mandarine [hg|default]:~/p/.../beancount/parser$ bison --version
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mandarine [hg|default]:~/p/.../beancount/parser$ flex --version
flex 2.5.39
tbm commented 8 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


BTW, the version you're pointing me to is on the remove_position branch. If you bisect, you'll want to find a way to restrict to the default branch.

tbm commented 8 years ago

Original comment by Aaron Bull Schaefer (Bitbucket: elasticdog, GitHub: elasticdog).


My Mercurial-fu is definitely lacking in comparison to Git, so I wasn't able to figure out how to use hg bisect only on the default branch. I instead tried manually checking out revisions, but wasn't able to get a clean build...so I tried a fresh clone and everything worked. Not sure what changed within my workspace, but I'm up and running now.

I apologize for the noise...it seems like my pattern of periodically running this seems to break every now and then:

hg pull
hg update
python3 setup install
make build

...is there a better sequence of steps I should be doing?

tbm commented 8 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


hg fetch # same as (hg pull; hg update), you might have to install the "fetch" extension make clean build

That's it. If you python3 setup install, that will build and install it somewhere else.

If you use it locally -- I highly recommend it, just make your PYTHONPATH include .../beancount/src/python and use "make clean build". This way you can also test other branches at some point if you want to.

tbm commented 8 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


Not a bug.

tbm commented 8 years ago

Original comment by Aaron Bull Schaefer (Bitbucket: elasticdog, GitHub: elasticdog).


So that's basically what I have been doing (I usually hg fetch, but expanded that above since it is an extension).

Thus far, I've not needed to run things locally and liked using python3 setup install so the binaries were under /usr/local/bin, which is already in my $PATH...but I don't think things worked without my also running make clean build regularly. Should that not be the case?

tbm commented 8 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


If there's no warning that your parser is out-of-date, you should be able to run without rebuilding. If there's a warning, then you should rebuild. That's how I work myself, never had any problems.

tbm commented 6 years ago

Original comment by Vivek G (Bitbucket: seltzered, GitHub: seltzered).


FWIW, I just came across this issue, but it seemed to be due to using a fairly old bison (macos default of 2.3). Updating to 3.x via homebrew resolved it.

tbm commented 6 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


Thanks Vivek. Perhaps there ought to be a version check.