hadoop 2.2.0版本 'protoc --version' did not return a version ->

按照hadoop官方網站的文檔,路徑爲http://hadoop.apache.org/docs/r2.2.0/hadoop-project-dist/hadoop-common/SingleCluster.html.用svn co http://svn.apache.org/repos/asf/hadoop/common/trunk下載資源,使用 mvn clean install -DskipTests 進行編譯時候,拋出異常

INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did not return a version -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :hadoop-common

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did not return a version -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :hadoop-common


經過查找原因,適用於沒有沒有安裝 protoc 2.5.0,在官網提示爲:NOTE: You will need protoc 2.5.0 installed.

需要安裝 protoc 2.5.0,他是google的一個數據緩衝高效可擴展的服務包,

下載地址爲http://code.google.com/p/protobuf/downloads/list

由於使用的linux系統,所以下的 protobuf-2.5.0.tar.gz   2.3 MB

然後,安裝protobuf 服務包,官方提供的命令如下:

$ ./configure
$ make
$ make check
$ make install
 如果,如果系統默認安裝了gcc,將會順利的完成,如果沒有的話,將會拋出找不到  找不到當前的文件夾 $path路徑,

由於我是用的ubuntu,使用
sudo apt-get install gcc 
如果不能安裝完成,你需要更行
sudo apt-get update 更新ubuntu 的庫
然後再繼續的安裝 
sudo apt-get install gcc 

面對下面的錯誤,百度一下,這是缺少相應的庫導致的,所以可能在不同系統,安裝不同軟件的時候都可能出現。

configure: error: C++ preprocessor "/lib/cpp" fails sanity check


使用下載庫文件, sudo apt-get install build-essential

然後,在執行./configure,順利的完成


在後查看版本,$protoc --version

將會提示找不到 protoc 

讓你安裝  sudo apt-get install protobuf-compiler 

不要安裝,如果安裝了,它和你的protobuf-2.5.0.tar.gz  沒什麼關係,運行

$protoc --version

libprotoc.2.4.1

hadoop 要求的版本爲2.5.0,mvn編譯將不通過。

這個時候不慌,因爲protobuf-2.5.0.tar.gz  我們已經編譯完了,

只需要完成配置完成就行了

$sudo vi /etc/profile  

export PROTOC_HOME=/opt/protobuf-2.5.0

export PATH=$PATH:$PROTOC_HOME/src

然後,

$protoc --version

libprotoc.2.5.0

祝你成功









發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章