gtxyzz

Ubuntu编译Hadoop编码异常总结

gtxyzz 运维技术 2022-11-20 464浏览 0

错误1:

[ERROR]Failedtoexecutegoalorg.apache.hadoop:hadoop-maven-plugins:2.2.0:protoc(compile-protoc)onprojecthadoop-common:org.apache.maven.plugin.MojoExecutionException:protocversionis'libprotoc2.4.1',expectedversionis'2.5.0'->[Help1] 
[ERROR] 
[ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch. 
[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging. 
[ERROR] 
[ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles: 
[ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
[ERROR] 
[ERROR]Aftercorrectingtheproblems,youcanresumethebuildwiththecommand 
[ERROR]mvn<goals>-rf:hadoop-common

安装protoc

wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz

(此处下载https://code.google.com/p/protobuf/downloads/list)

解压, 进入根目录执行 sudo ./configure –prefix=/usr

若安装报错:

cpp: error trying to exec ‘cc1plus’: execvp: No such file or directory

则安装g++

sudo apt-get install g++

sudo make

sudo make check

sudo make install

protoc –version

遇到protoc: error while loading shared libraries: libprotoc.so.8: cannot open shared object file: No such file or directory时,如ubuntu系统,默认安装在/usr/local/lib下,需要指定/usr。sudo ./configure –prefix=/usr 必须加上–proix参数,重新编译和安装。

错误2:

[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-antrun- 

plugin:1.6:run(make)onprojecthadoop-common:AnAntBuildExceptionhas 

occured:Executefailed:java.io.IOException:Cannotrunprogram"cmake"(in 

directory"/home/wyf/hadoop-2.0.2-alpha-src/hadoop-common-project/hadoop- 

common/target/native"):java.io.IOException:error=2,Nosuchfileordirectory 

->[Help1] 
[ERROR] 
[ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-e 

switch. 
[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging. 
[ERROR] 
[ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,please 

readthefollowingarticles: 
[ERROR][Help1] 

http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

安装Cmake

sudo apt-get install cmake

错误3:

ERROR]Failedtoexecutegoalorg.codehaus.mojo.jspc:jspc-maven-plugin:2.0- 
 
alpha-3:compile(hdfs)onprojecthadoop-hdfs:Executionhdfsofgoal 
 
org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3:compilefailed:Plugin 
 
org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3oroneofitsdependencies 
 
couldnotberesolved:Couldnottransferartifactant:ant:jar:1.6.5from/to 
 
central(http://repo.maven.apache.org/maven2):GETrequestof: 
 
ant/ant/1.6.5/ant-1.6.5.jarfromcentralfailed:Readtimedout->[Help1] 
[ERROR] 
[ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-e 
 
switch. 
[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging. 
[ERROR] 
[ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,please 
 
readthefollowingarticles: 
[ERROR][Help1] 
 
http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException 
[ERROR] 
[ERROR]Aftercorrectingtheproblems,youcanresumethebuildwiththecommand 
[ERROR]mvn<goals>-rf:hadoop-hdfs

安装ant

1.首先下载ant

百度网盘: apache-ant-1.9.4-bin.tar.gz

http://pan.baidu.com/s/1c0vjhBy

或则下面链接:

apache-ant-1.9.4-bin.tar.gz

2.解压

tar zxvf apache-ant-1.9.4-bin.tar.gz

3.配置环境变量

vim ~/.bashrc

export ANT_HOME=/home/xxl/apache-ant-1.9.4

export PATH=$ANT_HOME:$PATH

source ~/.bashrc

错误4:

[ERROR]Failedtoexecutegoalorg.apache.hadoop:hadoop-maven-plugins:2.4.0:prot 
oc(compile-protoc)onprojecthadoop-common:org.apache.maven.plugin.MojoExecut 
ionException:'protoc--version'didnotreturnaversion->[Help1] 
[ERROR] 
[ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswit 
ch. 
[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging. 
[ERROR] 
[ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleaserea 
dthefollowingarticles: 
[ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE 
xception 
[ERROR] 
[ERROR]Aftercorrectingtheproblems,youcanresumethebuildwiththecommand 

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

protobuf版本过低

安装2.5版本的即可

错误5:

[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-antrun-plugin:1.6:run(compile)onprojecthadoop-snappy:AnAntBuildExceptionhasoccured:Thefollowingerroroccurredwhileexecutingthisline: 
[ERROR]/home/ngc/Char/snap/hadoop-snappy/hadoop-snappy-read-only/maven/build-compilenative.xml:75:execreturned:2

这个原因比较恶心,是因为Hadoop snappy对gcc版本还有要求,因为我是2012年12月份的ubuntu12.04,所以gcc已经是4.6了,但是在google code那看到有人说他从gcc4.6回退成gcc4.4就ok了,我也是了一下,果然这个错误没有了。

gcc –version #查看gcc版本

gcc (Ubuntu/Linaro 4.4.7-1ubuntu2) 4.6.3

Copyright © 2010 Free Software Foundation, Inc.

本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;

包括没有适销性和某一专用目的下的适用性担保。

如何回退呢?

1. apt-get install gcc-4.4

2. rm /usr/bin/gcc

3. ln -s /usr/bin/gcc-4.4 /usr/bin/gcc

之后,再gcc –version,你就会发现,gcc已经变成4.4.7了。

错误6:

.[exec]/bin/bash./libtool--tag=CC--mode=linkgcc-g-Wall-fPIC-O2-m64-g-O2-version-info0:1:0-L/usr/local//lib-olibhadoopsnappy.la-rpath/usr/local/libsrc/org/apache/hadoop/io/compress/snappy/SnappyCompressor.losrc/org/apache/hadoop/io/compress/snappy/SnappyDecompressor.lo-ljvm-ldl 
[exec]/usr/bin/ld:cannotfind-ljvm 
[exec]collect2:ldreturned1exitstatus 
[exec]make:***[libhadoopsnappy.la]错误1 
[exec]libtool:link:gcc-shared-fPIC-DPICsrc/org/apache/hadoop/io/compress/snappy/.libs/SnappyCompressor.osrc/org/apache/hadoop/io/compress/snappy/.libs/SnappyDecompressor.o-L/usr/local//lib-ljvm-ldl-O2-m64-O2-Wl,-soname-Wl,libhadoopsnappy.so.0-o.libs/libhadoopsnappy.so.0.0.1

网上有很多 解决/usr/bin/ld: cannot find -lxxx 这样的博客,但是这里,我告诉你,他们的都不适用。因为这儿既不是缺什么,也不是版本不对,是因为没有把安装jvm的libjvm.so symbolic link到usr/local/lib。如果你的系统时amd64,可到/root/bin/jdk1.6.0_37/jre/lib/amd64/server/察看libjvm.so link到的地方,这里修改如下:

ln -s /root/bin/jdk1.6.0_37/jre/lib/amd64/server/libjvm.so /usr/local/lib/

问题即可解决。

错误7:

[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-antrun-plugin:1.6:run(make)onprojecthadoop-common:AnAntBuildExceptionhasoccured:execreturned:1->[Help1] 
[ERROR] 
[ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch. 
[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging. 
 
安装zlib-devel 
ubuntu安装是 
sudoapt-getinstallzlib1g-dev

安装zlib-devel

ubuntu安装是

sudo apt-get install zlib1g-dev

错误8:

[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-antrun-plugin:1.7:run(make)onprojecthadoop-pipes:AnAntBuildExceptionhasoccured:execreturned:1 
[ERROR]aroundAntpart...<execdir="/home/xxl/hadoop-2.5.2-src/hadoop-tools/hadoop-pipes/target/native"executable="cmake"failonerror="true">...@5:120in/home/xxl/hadoop-2.5.2-src/hadoop-tools/hadoop-pipes/target/antrun/build-main.xml 
[ERROR]->[Help1]

安装:sudo apt-get install libssl-dev

错误9:

[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-antrun-plugin:1.7:run(tar)onprojecthadoop-dist:AnAntBuildExceptionhasoccured:execreturned:1 
[ERROR]aroundAntpart...<execdir="/home/xxl/hadoop-2.5.2-src/hadoop-dist/target"executable="sh"failonerror="true">...@21:96in/home/xxl/hadoop-2.5.2-src/hadoop-dist/target/antrun/build-main.xml

安装:sudo apt-get install build-essential

sudo apt-get install libglib2.0-dev

原文出自:http://my.oschina.net/laigous/blog/356552

继续浏览有关 Hadoop 的文章
发表评论