compile hadoop-2.5.x on OS X(macbook)

  same as compile hbase ,it 's necessary for u to compile your own dist of hadoop to get best performance specified to your hardwares.

  bellow are some steps needed by this theme:

1.install some tools 

   a.cmake 2.6+

      download and set the path variable 

      this is used only if u want to make with native option,same like:

 

 mvn package -Pdist,native -DskipTests=true  -Dmaven.javadoc.skip=true

 

 

   b.protobuf  2.5+

     download and set variable

   c.mavn 3.0+

    same as above

 

2.comile hadoop by issuing

 

 mvn package -Pdist,native -DskipTests=true  -Dmaven.javadoc.skip=true -Dtar

 the results will like below:

main:
     [exec] $ tar cf hadoop-2.5.2.tar hadoop-2.5.2
     [exec] $ gzip -f hadoop-2.5.2.tar
     [exec] 
     [exec] Hadoop dist tar available at: /home/xxx/build-hadoop/hadoop-2.5.2-src/hadoop-dist/target/hadoop-2.5.2.tar.gz
     [exec] 
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-javadoc-plugin:2.8.1:jar (module-javadocs) @ hadoop-dist ---
[INFO] Building jar: /home/xxx/build-hadoop/hadoop-2.5.2-src/hadoop-dist/target/hadoop-dist-2.5.2-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Apache Hadoop Main ................................ SUCCESS [3:01.134s]
[INFO] Apache Hadoop Project POM ......................... SUCCESS [1:05.262s]
[INFO] Apache Hadoop Annotations ......................... SUCCESS [36.726s]
[INFO] Apache Hadoop Assemblies .......................... SUCCESS [0.232s]
[INFO] Apache Hadoop Project Dist POM .................... SUCCESS [40.162s]
[INFO] Apache Hadoop Maven Plugins ....................... SUCCESS [42.839s]
[INFO] Apache Hadoop MiniKDC ............................. SUCCESS [2:45.883s]
[INFO] Apache Hadoop Auth ................................ SUCCESS [36.327s]
[INFO] Apache Hadoop Auth Examples ....................... SUCCESS [13.556s]
[INFO] Apache Hadoop Common .............................. SUCCESS [3:46.794s]
[INFO] Apache Hadoop NFS ................................. SUCCESS [4.543s]
[INFO] Apache Hadoop Common Project ...................... SUCCESS [0.037s]
[INFO] Apache Hadoop HDFS ................................ SUCCESS [3:32.422s]
[INFO] Apache Hadoop HttpFS .............................. SUCCESS [28.563s]
[INFO] Apache Hadoop HDFS BookKeeper Journal ............. SUCCESS [31.706s]
[INFO] Apache Hadoop HDFS-NFS ............................ SUCCESS [3.193s]
[INFO] Apache Hadoop HDFS Project ........................ SUCCESS [0.042s]
[INFO] hadoop-yarn ....................................... SUCCESS [0.032s]
[INFO] hadoop-yarn-api ................................... SUCCESS [1:15.932s]
[INFO] hadoop-yarn-common ................................ SUCCESS [41.828s]
[INFO] hadoop-yarn-server ................................ SUCCESS [0.032s]
[INFO] hadoop-yarn-server-common ......................... SUCCESS [19.335s]
[INFO] hadoop-yarn-server-nodemanager .................... SUCCESS [52.061s]
[INFO] hadoop-yarn-server-web-proxy ...................... SUCCESS [2.190s]
[INFO] hadoop-yarn-server-applicationhistoryservice ...... SUCCESS [4.083s]
[INFO] hadoop-yarn-server-resourcemanager ................ SUCCESS [10.974s]
[INFO] hadoop-yarn-server-tests .......................... SUCCESS [0.469s]
[INFO] hadoop-yarn-client ................................ SUCCESS [4.002s]
[INFO] hadoop-yarn-applications .......................... SUCCESS [0.032s]
[INFO] hadoop-yarn-applications-distributedshell ......... SUCCESS [2.106s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher .... SUCCESS [1.710s]
[INFO] hadoop-yarn-site .................................. SUCCESS [0.028s]
[INFO] hadoop-yarn-project ............................... SUCCESS [4.258s]
[INFO] hadoop-mapreduce-client ........................... SUCCESS [0.067s]
[INFO] hadoop-mapreduce-client-core ...................... SUCCESS [14.625s]
[INFO] hadoop-mapreduce-client-common .................... SUCCESS [15.159s]
[INFO] hadoop-mapreduce-client-shuffle ................... SUCCESS [3.097s]
[INFO] hadoop-mapreduce-client-app ....................... SUCCESS [7.088s]
[INFO] hadoop-mapreduce-client-hs ........................ SUCCESS [6.639s]
[INFO] hadoop-mapreduce-client-jobclient ................. SUCCESS [13.638s]
[INFO] hadoop-mapreduce-client-hs-plugins ................ SUCCESS [1.573s]
[INFO] Apache Hadoop MapReduce Examples .................. SUCCESS [4.095s]
[INFO] hadoop-mapreduce .................................. SUCCESS [3.397s]
[INFO] Apache Hadoop MapReduce Streaming ................. SUCCESS [8.712s]
[INFO] Apache Hadoop Distributed Copy .................... SUCCESS [25.432s]
[INFO] Apache Hadoop Archives ............................ SUCCESS [1.784s]
[INFO] Apache Hadoop Rumen ............................... SUCCESS [4.306s]
[INFO] Apache Hadoop Gridmix ............................. SUCCESS [3.500s]
[INFO] Apache Hadoop Data Join ........................... SUCCESS [2.054s]
[INFO] Apache Hadoop Extras .............................. SUCCESS [2.298s]
[INFO] Apache Hadoop Pipes ............................... SUCCESS [7.284s]
[INFO] Apache Hadoop OpenStack support ................... SUCCESS [3.687s]
[INFO] Apache Hadoop Client .............................. SUCCESS [8.373s]
[INFO] Apache Hadoop Mini-Cluster ........................ SUCCESS [0.121s]
[INFO] Apache Hadoop Scheduler Load Simulator ............ SUCCESS [10.919s]
[INFO] Apache Hadoop Tools Dist .......................... SUCCESS [6.671s]
[INFO] Apache Hadoop Tools ............................... SUCCESS [0.033s]
[INFO] Apache Hadoop Distribution ........................ SUCCESS [32.206s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26:07.575s
[INFO] Finished at: Fri Dec 12 16:12:56 CST 2014
[INFO] Final Memory: 123M/940M
[INFO] ------------------------------------------------------------------------

 

 

3.problems

a.Exception in thread "main" java.lang.AssertionError: Missing tools.jar at: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/Classes/classes.jar. Expression: file.exists()

  this is as the compiler needs a file named tools.jar but localted at classes.jar under dir Classes but found nothing.so u can do workaround:

  

cd `java_home`/
mkdir Classes
cd Classes
ln -s ../lib/tools.jar classes.jar

   but u should know,in macbook,the command 'ln' is ONLY effect when u locate in the target dir,otherwise u will see:

  

cd `java_home`
mkdir Classes
ln -s lib/tools.jar Classes/classes.jar
# or:ln -s lib/tools.jar /absolute/path/to/Classes/classes.jar
cp Classes/classes.jar /tmp
Error:no such file or dir found

 

2.failed to compile target:hadoop mavn doc

   this is not important for this theme,so u can add a param to ignore it:

-Dmaven.javadoc.skip=true

 

 Ref:

 

你可能感兴趣的:(compile)