Bison build error on MacOS
Using the latest bison and flex from homebrew:
Jeroens-MacBook-Pro:libgraphqlparser jeroen$ make
[ 4%] [FLEX][GraphQLScanner] Building scanner with flex 2.6.4
[ 8%] Generating Ast.h
[ 13%] Generating Ast.cpp
[ 17%] Generating AstVisitor.h
[ 21%] Generating c/GraphQLAst.h
[ 26%] Generating c/GraphQLAst.cpp
[ 30%] Generating c/GraphQLAstForEachConcreteType.h
[ 34%] Generating JsonVisitor.h.inc
[ 39%] Generating JsonVisitor.cpp.inc
[ 43%] [BISON][graphqlparser_bison] Building parser with bison 3.2.1
parser.ypp:8.10-12: error: invalid version requirement: 3
%require "3"
^^^
make[2]: *** [parser.tab.cpp] Error 1
make[1]: *** [CMakeFiles/graphqlparser.dir/all] Error 2
make: *** [all] Error 2
I can change the require to from "3" to "3.0" which works but I still get these warnings:
[ 43%] [BISON][graphqlparser_bison] Building parser with bison 3.2.1
parser.ypp:298.17-43: warning: unset value: $$ [-Wother]
start: document { *outAST = $1; }
^^^^^^^^^^^^^^^^^^^^^^^^^^^
parser.ypp:446.23-26: warning: unused value: $2 [-Wother]
"..." "on" type_condition directives_opt selection_set { $$ = new InlineFragment(@$, $3, $4, $5); }
^^^^
parser.ypp:451.17-26: warning: unused value: $1 [-Wother]
"fragment" fragment_name "on" type_condition directives_opt selection_set { $$ = new FragmentDefinition(@$, $2, $4, $5, $6); }
^^^^^^^^^^
parser.ypp:451.42-45: warning: unused value: $3 [-Wother]
"fragment" fragment_name "on" type_condition directives_opt selection_set { $$ = new FragmentDefinition(@$, $2, $4, $5, $6); }
^^^^
parser.ypp:488.17-20: warning: unused value: $1 [-Wother]
boolean_value: TRUE { $$ = new BooleanValue(@$, true); }
^^^^
parser.ypp:489.17-21: warning: unused value: $1 [-Wother]
| FALSE { $$ = new BooleanValue(@$, false); }
^^^^^
parser.ypp:492.17-20: warning: unused value: $1 [-Wother]
null_value: NULL { $$ = new NullValue(@$); }
^^^^
parser.ypp:597.20-25: warning: unused value: $1 [-Wother]
schema_definition: SCHEMA directives_opt "{" operation_type_definition_list "}" { $$ = new SchemaDefinition(@$, $2, $4); }
^^^^^^
parser.ypp:609.25-30: warning: unused value: $1 [-Wother]
scalar_type_definition: SCALAR name directives_opt { $$ = new ScalarTypeDefinition(@$, $2, $3); }
^^^^^^
parser.ypp:612.25-28: warning: unused value: $1 [-Wother]
object_type_definition: TYPE name implements_interfaces_opt directives_opt "{" field_definition_list "}" { $$ = new ObjectTypeDefinition(@$, $2, $3, $4, $6); }
^^^^
parser.ypp:616.17-26: warning: unused value: $1 [-Wother]
| IMPLEMENTS type_name_list { $$ = $2; }
^^^^^^^^^^
parser.ypp:644.28-36: warning: unused value: $1 [-Wother]
interface_type_definition: INTERFACE name directives_opt "{" field_definition_list "}" { $$ = new InterfaceTypeDefinition(@$, $2, $3, $5); }
^^^^^^^^^
parser.ypp:647.24-28: warning: unused value: $1 [-Wother]
union_type_definition: UNION name directives_opt "=" union_members { $$ = new UnionTypeDefinition(@$, $2, $3, $5); }
^^^^^
parser.ypp:654.23-26: warning: unused value: $1 [-Wother]
enum_type_definition: ENUM name directives_opt "{" enum_value_definition_list "}" { $$ = new EnumTypeDefinition(@$, $2, $3, $5); }
^^^^
parser.ypp:665.31-35: warning: unused value: $1 [-Wother]
input_object_type_definition: INPUT name directives_opt "{" input_value_definition_list "}" { $$ = new InputObjectTypeDefinition(@$, $2, $3, $5); }
^^^^^
parser.ypp:668.28-33: warning: unused value: $1 [-Wother]
type_extension_definition: EXTEND object_type_definition { $$ = new TypeExtensionDefinition(@$, $2); }
^^^^^^
parser.ypp:671.23-31: warning: unused value: $1 [-Wother]
directive_definition: DIRECTIVE "@" name arguments_definition_opt ON directive_locations { $$ = new DirectiveDefinition(@$, $3, $4, $6); }
^^^^^^^^^
parser.ypp:671.67-68: warning: unused value: $5 [-Wother]
directive_definition: DIRECTIVE "@" name arguments_definition_opt ON directive_locations { $$ = new DirectiveDefinition(@$, $3, $4, $6); }
^^
I just ran into the same issue. Did you get any further?
No, I ended up running the bison generation step on Ubuntu Bionic.
It works for me on macOS using the latest release tag v7.0
@amrox Do you mind explaining exactly what you did? I am also experiencing the same problem and I am on macOS as well.
@Alan-Cha I just checked out the v7.0 tag and built normally. At least at the time the problem was only on the master branch.
@amrox Ohhh okay! I'm so sorry. I had a brain fart. Yep! Checking out v7.0 did the trick for me! Thanks a lot!
Hi,
I am running the same issue under linux 😕
I did a git-bissect and found latest commit compiling is 3b64cd5, first failing is 93afeda, so ≃ 15 commits ahead of tag 0.7.0 (and 4 commits behind HEAD of master).
Unfortunately I am not familiar with bison so I couldn't find what made this fail to compile.
git-blame tells @swolchok did the commits himself so I guess he may have another not committed build setup? :thinking:
Can confirm this issue running Arch and with bison 3.3.2-1 and flex 2.6.4-2 on the master commit (a292268), tag v0.7.0 works.
@jeroen As you state in your original issue, changing this line to %require "3.0" does actually fix the build process (despite it producing warnings). Do you see any reason not to make this change?
One note: in the Bison documentation, the C++ example actually denotes required versions to consist of two parts, e.g., %require "3.2".