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.

Bechir
  • 275
  • 1
  • 3
  • 8

4 Answers4

23

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.

Jeff Puckett
  • 1,711
  • 3
  • 24
  • 40
brunomvsouza
  • 346
  • 1
  • 4
  • 7
    To prevent update manager to overwrite this package `apt-mark hold libbison-dev` and `apt-mark hold bison` – Bechir Jun 03 '14 at 14:28
  • 1
    On the odd chance you need the 32-bit versions, you can get the downloads from here: http://packages.ubuntu.com/saucy/libbison-dev (I'm using Ubuntu 32-bit in a VM because I need to test some code on a 32-bit platform) – Andrea Jun 25 '14 at 11:59
  • Hey, take a look at my solution :) – Salehi May 12 '15 at 22:25
  • for i386, the links are: http://launchpadlibrarian.net/140087287/libbison-dev_2.7.1.dfsg-1_i386.deb and http://launchpadlibrarian.net/140087286/bison_2.7.1.dfsg-1_i386.deb – sbell Aug 11 '15 at 17:45
  • I do not recommend to install those as there is no guarantee they come to your server without virus and rootkis. – Daniel W. Apr 15 '16 at 15:55
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

Stormvirux
  • 4,446
  • 29
  • 35
  • 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 08 '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 08 '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 08 '14 at 14:25
2

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

Elder Geek
  • 35,476
  • 25
  • 95
  • 181
RJVB
  • 211
  • 2
  • 10
  • 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](http://askubuntu.com/help/whats-reputation) you will be able to [comment on any post](http://askubuntu.com/help/privileges/comment). – Luís de Sousa Aug 06 '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 06 '14 at 22:14
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!

iggyvolz
  • 59
  • 1