本文參考:http://blog.csdn.net/u012207077/article/details/13623367,感謝原文作者

執行 ant compile-native tar 報錯,這裡我在實際執行過程中遇到了以下的問題:

a.錯誤提示:

compile-java:
    [javac] /data/hadoop-lzo-master/build.xml:243: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

check-native-uptodate:

compile-native:
    [javah] 錯誤: 找不到類org.apache.hadoop.conf.Configuration。

BUILD FAILED
/data/hadoop-lzo-master/build.xml:269: compilation failed

解決方法:

  在 build.xml 裡面將

  <target name="compile-java" depends="init">
    <javac 
     encoding="${build.encoding}" 
     srcdir="${java.src.dir}"   
     includes="**/*.java"
     destdir="${build.classes}"
     debug="${javac.debug}"
     optimize="${javac.optimize}"
     target="${javac.version}"
     source="${javac.version}"
     deprecation="${javac.deprecation}">
      <compilerarg line="${javac.args} ${javac.args.warnings}" />
      <classpath refid="classpath"/>
    </javac>

    <copy todir="${build.classes}">
      <fileset dir="${java.src.dir}" includes="**/*.properties"/>
    </copy>

  </target>

加入一行

  <target name="compile-java" depends="init">
    <javac 

    includeantruntime="false"
     encoding="${build.encoding}" 
     srcdir="${java.src.dir}"   
     includes="**/*.java"
     destdir="${build.classes}"
     debug="${javac.debug}"
     optimize="${javac.optimize}"
     target="${javac.version}"
     source="${javac.version}"
     deprecation="${javac.deprecation}">
      <compilerarg line="${javac.args} ${javac.args.warnings}" />
      <classpath refid="classpath"/>
    </javac>

    <copy todir="${build.classes}">
      <fileset dir="${java.src.dir}" includes="**/*.properties"/>
    </copy>

  </target>

b. 

compile-native:
    [javah] 錯誤: 找不到類org.apache.hadoop.conf.Configuration。

BUILD FAILED
/data/hadoop-lzo-master/build.xml:270: compilation failed

解決方法:

在下面程式碼

    <javah classpath="${build.classes}"
           destdir="${build.native}/src/com/hadoop/compression/lzo"
           force="yes"
           verbose="yes">
      <class name="com.hadoop.compression.lzo.LzoCompressor" />
      <class name="com.hadoop.compression.lzo.LzoDecompressor" />
    </javah>
加入一行

    <javah classpath="${build.classes}"
           destdir="${build.native}/src/com/hadoop/compression/lzo"
           force="yes"
           verbose="yes">
      <class name="com.hadoop.compression.lzo.LzoCompressor" />
      <class name="com.hadoop.compression.lzo.LzoDecompressor" />

     <classpath refid="classpath" />
    </javah>