Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bison error: m4 subprocess failed

Tags:

bison

I'm trying to parse a grammar, but I get this error:

bison -t  -vd brest.y
brest.y: warning: 52 shift/reduce conflicts [-Wconflicts-sr]
brest.y: warning: 76 reduce/reduce conflicts [-Wconflicts-rr]
brest.y:167.105-121: warning: rule useless in parser due to conflicts [-     Wother]
        /*nil*/                                 {   $$=NULL;}
                                                                                                          ^^^^^^^^^^^^^^^^^
**bison: m4 subprocess failed**

The lines of grammar involved in warning are:

activity:   
        /*nil*/                                     {   $$=NULL;}
    |   resource activity                               {       $$=concatQuadruple(getQuadrupleResource($1),$2);}
    |   var_declaration activity                        {   $$=concatQuadruple(getQuadrupleVarDeclaration($1),$2);}
    |   invoke activity                                 {   $$=concatQuadruple($1,$2);}
    |   ASSIGN assignment ASSIGN_ activity              {   $$=concatQuadruple($2,$4);}
    |   respond                                         {   $$=getQuadrupleRespond($1);}
;

I have installed the following versions of bison and m4:

bison-3.0.2-3.fc21.x86_64

m4-1.4.17-6.fc21.x86_64

Any ideas?

like image 640
Jose V. Espi Avatar asked Feb 20 '26 07:02

Jose V. Espi


2 Answers

This question is 5 years old, but I have met this problem right now so I think my solution will be useful because its only thread in google with such question. I was running bison from windows (compiled from source using cygwin) and had the same problem:

bison error: '/usr/local/share/bison/m4sugar/m4sugar.m4': No such file or directory

bison error: m4 subprocess failed

The solution for me was to set two variables before running bison command:

set BISON_PKGDATADIR=[Home Dir]/usr/local/share/bison

set M4=m4

In my case [Home Dir] was D:/files/Cygwin. Also make sure to add Path environment variable in windows to run bison & m4: Path=[Home Dir]/bin

like image 89
MomoDev Avatar answered Feb 26 '26 19:02

MomoDev


I found the solution: /bin/m4 was installed with yum, and for any reason I don't know it had 0 bytes of size. This could be a bug from the repository, I fixed downloading and compiling it from GNU website http://ftp.gnu.org/gnu/m4/.

like image 42
Jose V. Espi Avatar answered Feb 26 '26 19:02

Jose V. Espi