English 中文(简体)
为什么我的Mac(OS X 10.7.3)有古老的Gnu Bison版本(2.3)?
原标题:Why does my Mac (OS X 10.7.3) have an old version (2.3) of Gnu Bison?

我mac上的GNU Bison版本为2.3, 但我知道Bison 2.5 早就发行了。 书“ em> Flex & amp; Bison

我应该自己升到2.5级吗 有必要吗

2.3和2.5之间有什么区别?

最佳回答

如果您使用 Brew :

brew tap homebrew/dupes && brew install bison

如果您使用 MacPorts :

sudo port install bison

如果你使用Fink,他们仍然在2.3, 就像苹果一样, 所以你必须自己编辑软件包。

如果您知道如何安装 Unix 软件, 下载它, 卸载它, 然后像往常一样配置/ 制造/ 安装 。

如果以上所有内容对你而言都是希腊语,请看Link http://macports.org ,并决定谁对你更友好。

问题回答

我也有同样的问题 麦克松10.9.5。

事后:

brew install bison

我把这个加到我的损耗简介里:

export PATH=/usr/local/Cellar/bison/3.0.4/bin:$PATH

(by the time you read this, your version may be different from 3.0.4) And after I restarted the Terminal it picked up the new version of Bison when I did bison -V

如果您使用 >zsh :

$ brew unlink bison
$ echo  export PATH="/usr/local/opt/bison/bin:$PATH"  >> ~/.zshrc
$ export LDFLAGS="-L/usr/local/opt/bison/lib"
$ source ~/.zshrc
$ bison -V
bison (GNU Bison) 3.4.1
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2019 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.

您可以安装新版本的家书组 :

$ brew install bison

...

This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Some formulae require a newer version of bison.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you ll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/bison/lib

==> Summary
?  /usr/local/Cellar/bison/3.0.4: 51 files, 2.2M, built in 74 seconds

但如果您运行 : bison -V , 它仍会输出2.3, 而不是新安装的 3.0. 4。 要强制执行此操作, 您可以运行 :

arganzhengs-MacBook-Pro:thrift argan$ brew unlink bison
Unlinking /usr/local/Cellar/bison/3.0.4... 0 symlinks removed
arganzhengs-MacBook-Pro:thrift argan$ brew link bison
Warning: bison is keg-only and must be linked with --force
Note that doing so can interfere with building software.
arganzhengs-MacBook-Pro:thrift argan$ brew link bison --force
Linking /usr/local/Cellar/bison/3.0.4... 9 symlinks created
arganzhengs-MacBook-Pro:thrift argan$ bison -V
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 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.
arganzhengs-MacBook-Pro:thrift argan$ source ~/.bash_profile 
arganzhengs-MacBook-Pro:thrift argan$ bison -V
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.

所以我想出了怎么摆脱野牛 在Mojave和Catalina上建立的问题。

我所做的是:

$ brew install bison
$ cp /usr/local/opt/bison/bin/bison /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bison

-- -- -- -- --

Didn t need admin privileges, the cp command will overwrite the bison binary in your Xcode app with the latest one installed by homebrew.

现在,我可以做到这一点:

    $ bison -V
bison (GNU Bison) 3.7.1

在Mojave运行的多种macOS系统上建造葡萄酒一直有很多问题。 主要是因为我从未听说过的图书馆需要这个奇怪的需求, 但这个修补方法让它起作用了。

我用Brew安装了包件,但这并不更新野牛的位置,我仍然看到野牛2.3,而不是2.5。

然后我发现新野牛的位置不同

bash-3.2$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Users/taposh/anaconda/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/m4/bin/
bash-3.2$ PATH=/usr/local/bison/bin/:$PATH
bash-3.2$ which bison
/usr/local/bison/bin//bison

bash-3.2$ bison --version
bison (GNU Bison) 2.5
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2011 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.

因为野牛已经安装了, 的默认版本是2.3。 所以我们应该做一些如下的事情:

  1. 安装更高版本的 OS 野牛

    如果您使用 Brew, 请尝试使用此命令- brew 安装野牛, 它将会安装 3. 0.2 野牛 。 二进制包在我的电脑里 / usr/ local/ Cellar/ bison/ 3. 0.4/ bin/ 。

    或者你可以通过源码安装野牛,在离子网站