Ubuntu BYACC / BTYACC 语法错误

Ubuntu BYACC / BTYACC Syntax error

我正在尝试为我的 Raspberry Pi 2.

编译 kodi 的 libxkbcommon 库

宿主机是专用服务器运行Ubuntu16.04 x64.

现在我尝试编译 libxkbcommon 时出现两个错误,这取决于我使用的是什么 yacc:

byacc:

YACC     src/xkbcomp/parser.c
yacc: e - line 219 of 
"/opt/kodi/xbmc/tools/depends/target/libxkbcommon/raspberry-pi2-release/src/xkbcomp/parser.y", syntax error
%destructor { FreeStmt((ParseCommon *) $$); }
^
Makefile:1637: recipe for target 'src/xkbcomp/parser.c' failed

btyacc:

parser.y:85: syntax error

这里是libxkbcommon的源代码:

https://github.com/xkbcommon/libxkbcommon

xbcomp/parser.y 文件需要一些(非常有用的)bison 扩展,所以它不能被所有的 yacc 变体处理。

  • btyacc 不支持与 bison 兼容的纯解析器声明。 (它有一个不同的、不完全兼容的机制来实现相同的功能。)所以它在其中一个声明的第一个实例上失败。

  • 应该可以使用 byacc,但不能使用 Ubuntu 软件包存储库中可用的版本。尽管 Ubuntu 包存储库更改历史似乎表明其意图是包含允许 %destructor 的构建选项,但 byacc 存储库中当前可用的实际二进制文件是在没有该选项的情况下构建的。 (它也有好几年了,我认为使用更新的版本会很有用。)我将其报告为 launchpad bug 1776270,并提出了可能的修复建议。

  • 我相信您将能够使用 Gnu bison 构建软件,它作为 Ubuntu 软件包 bison 提供。由于这是开发人员机器上安装的最流行的 yacc 版本,使用 bison 构建失败可能早就被注意到了。

如果您更愿意使用 byacc,无论出于何种原因,您都必须自己下载并构建它。您可以从 Thomas Dickey's byacc page 获取最新版本,然后使用通常的过程构建它:untar、configure、make、make install。当我对此进行测试时,我使用了以下配置行:

./configure --enable-btyacc  --program-prefix=b  --prefix=/usr

只有第一个选项是必需的

* --program-prefix=b   Install it as `byacc` rather than `yacc`
* --enable-btyacc      Necessary for %destructor support
* --prefix=/usr        Install it in /usr/bin and /usr/man. The default
                       is /usr/local/bin and /usr/local/man, which failed on
                       my Ubuntu install because of a missing -D option in the
                       install command in the Makefile.