Building hadoop by installing protoc 2.5.x [Google Protocol Buffers Compiler] on a Mac

Hadoop trunk 3.0 Snapshot build fails if compiled with a protoc newer than 2.5. For instance, if the protoc version is 2.6.1, you will see a build error as

[ERROR] Failed to execute goal 
org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc 
(compile-protoc) on project hadoop-common: 
org.apache.maven.plugin.MojoExecutionException: 
protoc version is 'libprotoc 2.6.1', 
expected version is '2.5.0' -> [Help 1]
[ERROR]

To fix this, install protoc 2.5.x on your mac.

Steps:

Building from source
  1. Download latest version of protocol buffer [https://code.google.com/p/protobuf/downloads/list].
    • wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2
  2. Untar the tar.bz2 file
    • tar xfvj protobuf-2.5.0.tar.bz2
  3. Configure the protobuf.
    •  cd protobuf-2.5.0
    • ./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
    • You can use the --prefix parameter to install to a location other than the default "/usr/local/bin"
  4. Make the source
    • make -j 4
    • sudo make install
  5. If you already have protoc 2.6.1 installed, unlink it and link in the newly installed protoc 2.5.x
Advertisements

About vrushaliscorner

an engineer trying to find her way in silicon valley
This entry was posted in build errors, computer science, hadoop, maven, protobuf, protoc, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s