Wednesday, March 14, 2012

Installing Protocol Buffer 2.3.0 in newer Ubuntu versions


Protocol buffer is an important api for storing data internally. But, it has one severe limitation which requires you to have only specific version only. So, when you move into newer version of ubuntu where older protocol buffer version is no more supported then you have to uninstall the newer protocol buffer and replace it by old one eg. 2.3.0.

Here are the steps that you need to do that

# remove existing version
sudo apt-get remove libprotobuf* (* is version you may be having eg. 5, 7, etc)
sudo apt-get remove protobuf-compiler
sudo apt-get remove python-protobuf 

#time to install new one 
sudo apt-get install g++ # if you don't have g++ installed

#download protocol buffer
wget your-protocol-bufer.tar.gz
tar xvf your-protocol-bufer.tar.gz
cd protobuf-2.3.0
./configure
make
make check
sudo make install
cd python
sudo python setup.py install (it attempts to download setuptools-0.6c9-py2.7.egg file from location. But, it is not present. So, download the one available at location http://pypi.python.org/packages/2.7/s/setuptools/ and add it on current location. After adding, rename the downloaded file by setuptools-0.6c9-py2.7.egg and re-run the script again)
sudo ldconfig
protoc --version
libprotoc 2.3.0

Hope it was installed successfully :)

2 comments:

  1. Two notes.
    1) The protobuf-2.3.0.tar.gz can be downloaded from
    http://code.google.com/p/protobuf/downloads/list

    2) The setup tool version is newer (setuptools-0.6c11-py2.7 egg). There is no older version available to download. In order to make it work, you need to replace ez_setup.py with
    http://peak.telecommunity.com/dist/ez_setup.py

    Also see
    http://notes.richdougherty.com/2012/07/python-setuptools-bootstrap-errors.html

    -Anil Shrestha

    ReplyDelete
  2. maybe they have fixed this bug but at time of writing this was not the case. Anyways thanks for informing :)

    ReplyDelete