1. 程式人生 > >hadoop 2.2.0版本 'protoc --version' did not return a version ->

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

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的一個數據緩衝高效可擴充套件的服務包,

然後,安裝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 

$protoc --version

libprotoc.2.4.1

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

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

$sudo vi /etc/profile  

export PROTOC_HOME=/opt/protobuf-2.5.0

export PATH=$PATH:$PROTOC_HOME/src

然後,

$protoc --version

libprotoc.2.5.0

祝你成功