Taming Bison When Building Qt 5.0.x on Ubuntu 14.04

When trying to build Qt 5.0.2 on my brand new Ubuntu 14.04 LTS system, the build failed with the following error message in the QtWebkit module:

generated/glslang_tab.cpp:1785:30: error: too few arguments to function 'int yylex(YYSTYPE*, void*)'

A bit of googling revealed that Qt and bison conspired for this problem. Fortunately, the bug report QTBUG-32913 gives a hint how to fix the problem: “Note that reverting to Bison 2.7.1 causes the compile to succeed.”

Ubuntu 14.04 comes with bison 3.0.x, which is too new for the Qt 5.0.x build. The simplest way to downgrade bison to version 2.7.1 is to download the sources and to build bison.

The build is done with the usual troika of commands:

./configure
make
make install

This installs bison and yacc into /usr/local/bin. PATH normally contains this path. And, the Qt build will pick up bison 2.7.1 from there. Done!

Note: Qt 5.1.x is most likely also affected, because the fix is done for Qt 5.2 only.