How-to compile Hadoop on Windows 8
Steps
- Have at least Visual Studio 2010 installed
- Install JDK 1.7 or OpenJDK
- Install Maven 3.0+
- Grab last Hadoop 2.6 source distribution
Java Installation
After launching executable installation file just set JAVA_HOME environment variable :
JAVA_HOME=$java_installation_dir
Build Hadoop Distribution
- add maven binary directory into your PATH environment variable
In a Visual Studio command prompt :
cd hadoop-2.6.0-src mvn package -Pdist,native-win -DskipTests -Dtar
The last command compiles java libraries AND binary dynamic libraries. Thats why maven command MUST be launches in a Visual Studio compiler shell. Then you should have some issues like this one :
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.4.0:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: "protoc --version" did not return a version -> [Help 1]
Indeed some dependencies are missing :
Protoc : https://developers.google.com/protocol-buffers/docs/downloads Hadoop 2.6.0 is dependant of 2.5.0 version. You must download the exact version
Then Hadoop native build is based on CMake. Personally I installed it via Chocolatey
choco install cmake
Then I relaunched maven command line and everything built perfectly.