0

I am trying to compile Hadoop 3.1 from its source code. Once inside docker container i am building it with maven following included instructions in BUILDING.txt inside Hadoop's source code files. While Apache Hadoop Common ............................... FAILURE [ 0.458 s] is trying to build, i am getting the following error, regarding protoc --version

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

However, the protoc command is working on my installation:

$ protoc
Missing input file.
$ protoc --version
libprotoc 2.5.0

Same thing is happening with protoc version 3.0.

Anyone experienced something similar?

David Guyon
  • 2,759
  • 1
  • 28
  • 40
Sarriman
  • 382
  • 5
  • 22

1 Answers1

0

After not finding the exact solution, here is a workaround.

Hadoop's source code, comes with ./start-build-env.sh. Upon running the script, a Docker container will be launched by it, in which Hadoop can be build with Maven.

All the necessary libraries exist in the container, but are only included in user's $PATH, and not root's $PATH. That's a problem because it comes handy using sudo to build the package, and that's the reason that protoc --version could not return something.

Now every container launched by ./start-build-env.sh seems to be temporary, and you can't edit the root's $PATH via ~/.bashrc. A workaround is to launch the container through ./start-build-env.sh and from another terminal window, log into the container using the command: sudo docker exec -it <container> bash. Now you can download a simple editor (like nano or vi through apt-get), and edit the default $PATH in visudo.

Then the command sudo mvn package -Pdist... inside the container, wont stuck in the problem I described above

Sarriman
  • 382
  • 5
  • 22