1. 安装ant
从http://ant.apache.org/下载最新的ant,将其解压缩,然后安装README所述的方法即可完成安装
2. 在hadoop目录下,执行ant -file build.xml进行编译,提示:
compile-rcc-compiler:
[javac] /home/hadoop-1.0.4/build.xml:463: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
compile-core-classes:
[javac] /home/hadoop-1.0.4/build.xml:487: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
compile-hdfs-classes:
[javac] /home/hadoop-1.0.4/build.xml:576: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /home/hadoop-1.0.4/build/classes
解决方法是进入build.xml文件,在相应的行加入:
includeantruntime="false"
3. 之后再执行ant -file build.xml,会提示:
create-native-configure:
[exec] configure.ac:47: error: possibly undefined macro: AC_PROG_LIBTOOL
[exec] If this token and others are legitimate, please use m4_pattern_allow.
[exec] See the Autoconf documentation.
[exec] autoreconf: /usr/bin/autoconf failed with exit status: 1
解决方法:
yum install libtool
4. 编译后,要将hadoop/build目录下的内容拷贝到集群的各个结点上,否则在mp的过程中,会提示如下错误:
2014-03-04 17:11:22,593 ERROR org.apache.hadoop.mapred.TaskTracker: Shutting down. Incompatible buildVersion.