Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my Mac (OS X 10.7.3) have an old version (2.3) of Gnu Bison?

Tags:

macos

gnu

bison

The version of GNU Bison on my mac is 2.3 but I know that Bison 2.5 was released long ago. The book Flex & Bison uses version 2.5.

Should I upgrade to 2.5 myself? Is it necessary?

What's the difference between 2.3 and 2.5?

like image 516
Alick Avatar asked May 28 '12 03:05

Alick


People also ask

What is macOS 10.7 called?

OS X Lion, also known as Mac OS X Lion, (version 10.7) is the eighth major release of macOS, Apple's desktop and server operating system for Mac computers. Apple Inc.


2 Answers

If you are using 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.
like image 112
suyash Avatar answered Nov 05 '22 01:11

suyash


So I figured out how to get rid of bison build issues on Mojave and Catalina.

Here's what I did:

$ 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.

now I can do this:

    $ bison -V
bison (GNU Bison) 3.7.1

Been having so many problems building wine on multiple macOS systems running Mojave. Mostly due to this weird need for a library I've never heard of, but this fix got it working.

like image 20
Matt Andrzejczuk Avatar answered Nov 05 '22 01:11

Matt Andrzejczuk