11

When I try to install bison on my ubuntu 14.04 using the command sudo apt-get install bison, the version 3 is installed.

I would like to downgrade bison to use the version 2.7.

How can I do it?

Thanks.

  • I have a better solution, Check my answer :) – Salehi May 16 '15 at 16:27
22

I installed last pkgs of bison (2.7.1) and libbison-dev (2.7.1) from Saucy and it worked like a charm.

wget http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb
wget http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb
dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb
dpkg -i bison_2.7.1.dfsg-1_amd64.deb

To prevent update manager from overwriting this package

apt-mark hold libbison-dev
apt-mark hold bison    

Done.

| improve this answer | |
4

Just give the package version also as follows:

apt-get install pkg=version

and you can get all the available versions using apt-cache showpkg bison

| improve this answer | |
  • I tried apt-get install bison=2:2.7.1.dfsg-1 but apt-get still complain E: Version '2:2.7.1.dfsg-1' for 'bison' was not found – Bechir Apr 8 '14 at 14:09
  • 2
    This will only work if bison 2.7 is there in the archives but it is not there. you can see it by running apt-cache showpkg bison to see the versions available. One easy way would be adding saucy dev repo just to install bison 2.7. – Stormvirux Apr 8 '14 at 14:18
  • 2
    I fixed by manually installing it. I thought there is a clean way to do it :( . Any how, thanks for your help :) – Bechir Apr 8 '14 at 14:25
2

You can install bison version 2.7 via linuxbrew. Once you have installed linuxbrew by:

ruby -e "$(wget -O- https://raw.github.com/Homebrew/linuxbrew/go/install)"

and adding the following to the bottom of .bashrc or .zshrc:

export PATH="$HOME/.linuxbrew/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/.linuxbrew/lib:$LD_LIBRARY_PATH"

You can install Bison 2.7!

brew install bison27

Homebrew is meant for macs, so it will yell at you for not using your Mac properly if you run brew doctor. As Macs already have Bison installed, it will refuse to finish the install. You can safely force it by doing:

brew link bison27 --force

And now check bison -V to see you are using Bison 2.7!

| improve this answer | |
  • 3
    linux brew shouldn't be a thing! – Greg Mar 4 '15 at 15:27
  • @Greg it's convenient for mac users that want a simple script to make their linux and mac homes feel the same – Steve Buzonas Apr 13 '15 at 2:39
1

bison2 (2:2.7.1.dfsg-1-ppa1) is available from my ppa here

| improve this answer | |
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Luís de Sousa Aug 6 '14 at 18:59
  • Indeed, my answer doesn't explain how to downgrade, and I should have clarified that my package installs bison 2.7.1 alongside the v3 version in "trusty". (I also wasn't aware I can now comment on posts!) – RJVB Aug 6 '14 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.