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

祝你成功

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.