I want to make one project on java using netty and protobuf for the communication between client and server. Please guide me how could I install protobuf on ubuntu 12.04?
4 Answers
Taken from http://www.confusedcoders.com/random/how-to-install-protocol-buffer-2-5-0-on-ubuntu-13-04:
Protocol buffer is a serialization format developed by Google. It is Interface driven and is useful for applications that communicate over the wire. Below are the steps for protocol buffer installation.
Download protocol buffer. Protocol buffer libs can be downloaded here. Download protocol buffer.
Check if g++ compiler is installed on box. Protocol buffer needs g++ compiler to be present on your box before it can be built. This is a crisp post on how to install g++ compiler on your box. Install g++ compiler.
Extract the protocol buffer archive and switch to the extracted directory.
Inside the extracted directory hit the below commands to install protocol buffer. These may take a while, kindly be patient.
./configure make make check sudo make install protoc --versionThat's it. Protocol buffer version 2.5.0 is installed on your box.
Note: Sometimes the latest version of protocol version does not load up. So we can do it manually by this command
sudo ldconfig protoc --version
- 207,228
- 129
- 2
It appears that 12.04 is one of the first versions containing protobuf under apt-get!
Simply run:
sudo apt-get install libprotobuf-java protobuf-compiler
and you should be all set to use protobufs with Java.
That being said, 12.04 only supports getting up to protobuf v2.4 this way. So if you need newer features, you'll need to obtain it from the github as described in the other answer.
- 178
As to me, I install protpbuf 2.6.1 in ubuntu12
1. download
https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
2. install
tar -zxvf protobuf-2.6.1.tar.gz #unzip
sudo apt-get update
sudo apt-get install build-essential
cd protobuf-2.6.1/
./configure
make -j10
make check -j10
sudo make install -j10
3. check install successfully
protoc --version # if echo 'libprotoc 2.6.1' then successfully
4. If failed
If it shows error "protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object file: No such file or directory "
sudo updatedb locate libprotoc.so.9
/usr/local/lib/libprotoc.so.9 /usr/local/lib/libprotoc.so.9.0.1
So we need add it to LD_LIBRARY_PATH
vi ~/.bashrc then add
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Then:
source ~/.bashrc
protoc --version
you will get libprotoc 2.6.1
- 191
2019 update
Here's how I installed protobuf in order to build Eternal Terminal (a pretty amazing terminal emulator that combines autossh with mosh but gives you native scrolling):
sudo apt install libprotobuf-dev protobuf-compiler
- 4,032