Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install protobuf 2.5 on Arch Linux for compiling hadoop 2.6.0 using maven 3.3.1?

Am looking for installing protobuf 2.5.0 on Arch Linux, so that protoc-2.5.0.so is installed on the OS, so that I can go ahead with building hadoop 2.6.0 from source and make my life easy! :)

BTW, protobuf 2.6.0 does not compile when hadoop is built from source I have tried that as well. Ubuntu 14.04 comes with protoc 2.5.0. I DO NOT want to use Ubuntu.

Please check the screenshot first (there is no protobuf 2.5.0), since the problem lies there.. I guess am getting the following exception, I am aware that protoc is not installed in arch linux currently.

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.6.0:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did not return a version -> [Help 1]

Please help me out, since, I have spent 4 hours every day from two days, with no luck.

like image 275
forkdbloke Avatar asked Apr 22 '15 12:04

forkdbloke


People also ask

How do I know if Protobuf is installed?

To check which version of protobuf is installed, use pip show protobuf or pip3 show protobuf in your Windows CMD, command line, or PowerShell.

What is Protobuf Linux?

Protocol Buffer, abbreviated as Protobuf, is an open source library developed by Google that allows to serialize or deserialize structured data. It is used to communicate with one another over a network and to store data when building applications.


2 Answers

Compiling Google's protobuf is pretty easy. I originally found out how to do it on this blog post while compiling hadoop myself.

But here is my version:

$ cd /usr/local/src/
$ wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
$ tar xvf protobuf-2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./autogen.sh
$ ./configure --prefix=/usr
$ make
$ make install
$ protoc --version

Install protobuf for java

$ cd java
$ mvn install
$ mvn package

You should be good to go.

To enable you to install different versions of protobuf, install stow then change ./configure --prefix=/usr to ./configure --prefix=/usr/local/stow/protobuf-2.5.0

Then link protobuf into your system with stow:

$ cd /usr/local/stow
$ stow protobuf-2.5.0

Note: stow uses /usr/local/bin by default. Make sure thats in your $PATH

To unlink that version of protobuf,

$ stow -D protobuf-2.5.0

Hope this helped.

like image 139
Rudker Avatar answered Oct 15 '22 16:10

Rudker


I wonder why the above answer got downvoted,even I had to perform few more steps (in addition to the accepted answer by Rudker) to get protobuf 2.5 installed on Ubuntu Xenial.

Leaving the additional steps here for everyone's benefit:

apt-get install autoconf in response to the error : ./autogen.sh: autoreconf: not found for command : ./autogen.sh

apt-get install libtool in response to the error : autoreconf: libtoolize is needed because this package uses Libtool for command : ./autogen.sh

apt install g++ in response to the error : configure: error: C++ preprocessor "/lib/cpp" fails sanity check for command : ./configure --prefix=/usr

like image 27
Binita Bharati Avatar answered Oct 15 '22 18:10

Binita Bharati