標籤:
原本通過brew 安裝了Hadoop 2.6.0,但是使用過程中報一個錯誤(錯誤描述),查了資料說是因為native庫的問題,看了一下,發現通過brew安裝的版本根本就沒有native目錄,所以下載了源碼自己編譯。結果陸續出了不少問題,記錄如下:
1.錯誤: 程式包com.sun.javadoc不存在
這個錯誤嘗試了很多方法,包括在pom.xml中指定tools.jar檔案等等
最後通過’export JAVA_HOME=/usr/libexec/java_home -v 1.6’命令切換JDK版本為1.6(OS X上安裝了最新的1.8.x版本)才解決
2.[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.6.0:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: ‘protoc --version‘ did not return a version -> [Help 1]
查了資料說是缺少protobuf庫,通過brew安裝之後,結果編譯時間提示需要的是2.5.0版本,但是brew安裝的是2.6.1版,所以只好卸載了,然後手動下載2.5.0版(https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz),然後自行編譯安裝
$ sudo ./configure
$ sudo make
$ sudo make check
$ sudo make install
$ sudo ldconfig
$ protoc --version
3.[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-common: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "cmake" (in directory "/usr/local/Cellar/hadoop/hadoop-2.6.0-src/hadoop-common-project/hadoop-common/target/native"): error=2, No such file or directory
通過brew install cmake安裝cmake
4.[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-common: An Ant BuildException has occured: exec returned: 1
再往前翻,看到
main:
[exec] -- Configuring incomplete, errors occurred!
[exec] See also "/usr/local/Cellar/hadoop/hadoop-2.6.0-src/hadoop-common-project/hadoop-comCMake Error at /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
[exec] Could NOT mon/target/native/CMakeFiles/CMakeOutput.log".
[exec] find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
[exec] JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
[exec] Call Stack (most recent call first):
[exec] /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
[exec] /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/FindJNI.cmake:286 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
[exec] JNIFlags.cmake:123 (find_package)
[exec] CMakeLists.txt:24 (include)
查了之後發現主要是因為cmake沒有找到jni.h檔案,再一看,在$JAVA_HOME目錄下根本沒有include目錄,這個mac內建的jdk1.6好像有問題,於是下載了JDK 1.7,並重新export JAVA_HOME
5.提示tools.jar錯誤
在$JAVA_HOME下mkdir classes, 然後ln -s ../lib/tools.jar classes.jar
Mac OS X 10.10編譯Hadoop 2.6.0筆記