Ubuntu编译Hadoop编码异常总结

错误1:

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.2.0:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: protoc version is ‘libprotoc 2.4.1‘, expected version is ‘2.5.0‘ -> [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

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] Failed to execute goal org.apache.maven.plugins:maven-antrun-

    plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has

    occured: Execute failed: java.io.IOException: Cannot run program "cmake" (in

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

    common/target/native"): java.io.IOException: error=2, No such file or directory

    -> [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

安装Cmake

sudo apt-get install cmake

错误3:

ERROR] Failed to execute goal org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-

alpha-3:compile (hdfs) on project hadoop-hdfs: Execution hdfs of goal

org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3:compile failed: Plugin

org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3 or one of its dependencies

could not be resolved: Could not transfer artifact ant:ant:jar:1.6.5 from/to

central (http://repo.maven.apache.org/maven2): GET request of:

ant/ant/1.6.5/ant-1.6.5.jar from central failed: Read timed out -> [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/PluginResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[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] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.4.0:prot
    oc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecut
    ionException: ‘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 swit
    ch.
    [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 rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
    xception
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command

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

protobuf版本过低

安装2.5版本的即可

错误5:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (compile) on project hadoop-snappy: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /home/ngc/Char/snap/hadoop-snappy/hadoop-snappy-read-only/maven/build-compilenative.xml:75: exec returned: 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-3.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=link gcc -g -Wall -fPIC -O2 -m64 -g -O2 -version-info 0:1:0 -L/usr/local//lib -o libhadoopsnappy.la -rpath /usr/local/lib src/org/apache/hadoop/io/compress/snappy/SnappyCompressor.lo src/org/apache/hadoop/io/compress/snappy/SnappyDecompressor.lo  -ljvm -ldl
     [exec] /usr/bin/ld: cannot find -ljvm
     [exec] collect2: ld returned 1 exit status
     [exec] make: *** [libhadoopsnappy.la] 错误 1
     [exec] libtool: link: gcc -shared  -fPIC -DPIC  src/org/apache/hadoop/io/compress/snappy/.libs/SnappyCompressor.o src/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] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has occured: exec returned: 1 -> [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.

安装zlib-devel
ubuntu安装是
sudo apt-get install zlib1g-dev

错误8:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-pipes: An Ant BuildException has occured: exec returned: 1
[ERROR] around Ant part ...<exec dir="/home/xxl/hadoop-2.5.2-src/hadoop-tools/hadoop-pipes/target/native" executable="cmake" failonerror="true">... @ 5:120 in /home/xxl/hadoop-2.5.2-src/hadoop-tools/hadoop-pipes/target/antrun/build-main.xml
[ERROR] -> [Help 1]

安装:sudo apt-get install libssl-dev

时间: 2024-08-01 13:24:04

Ubuntu编译Hadoop编码异常总结的相关文章

64位Ubuntu 编译 hadoop源码

本人下载了最新版的ubuntu64(14.04)位桌面版系统,在安装hadoop2.6.0时,由于官方的hadoop是在32位机子上编译的,故需下载hadoop源码进行编译. 准备:hadoop-2.6.0-src jdk1.7.0_75(由于最新版的jdk是1.8.0_31版本的,而我在用这个版本编译hadoop时出现了问题,后来发现1.8.0是在hadoop出来之后出来的,所以可能有些不支持,故建议用1.7.0版本的) 1.安装JDK 安装jdk的方式大家可以网上搜一下,或者通过这个链接ht

ubuntu下编译Hadoop

Ubuntu 下编译 Hadoop-2.9.2 系统环境 系统: ubuntu-18.10-desktop-amd64 maven: Apache Maven 3.6.0 jdk: jdk_1.8.0_201 ProtocolBuffer: portoc-2.5.0 OpenSSL: OpenSSL 1.1.1 cmake: cmake3.12.1 hadoop: hadoop-2.9.2 安装所需环境 # 安装各种所需依赖库 $ sudo apt-get install autoconf au

通过Bigtop编译Hadoop组件的rpm包

我安装所使用的系统是CentOS6,也可以是red5.6都可以.Bigtop官方网上有Ubuntu系统安装的具体过程. 1.    安装系统依赖 1.1   系统更新并安装新的包 Building Bigtop requires the following tools: ·        Java JDK 1.6 ·        Apache Ant(可以通过yum安装) ·        Apache Maven ·        wget ·        tar ·        git

编译Hadoop源码

背景: 在阅读hadoop源代码过程中会发现部分类或者函数无法找到,这是由于Hadoop2.0使用了Protocol Buffers定义了RPC协议, 而这些Protocol Buffers文件在Maven编译源代码才会生成对应的java类,因此若其他类在源代码中引用这些类则暂时无法找到. 解决办法就是先对hadoop源码进行编译,再导入eclipse工程. 一.基础软件: 软件 下载地址 推荐版本 JDK http://www.oracle.com/technetwork/java/javas

自己动手一步一步安装hadoop(含编译hadoop的native本地包)

最近项目需要用到hadoop,边学习边应用,第一步无疑是安装hadoop,我安装的是hadoop-2.4.1,下面是详细步骤,做备忘以后查看 一.下载依赖软件 1.java hadoop官网说明只支持java 6和7 ,下载最新的java7 http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz 2.maven 从maven官网下载http://maven.apache.org/download

CentOS 6.4 64位 源码编译hadoop 2.2.0

CentOS 6.4 64位 源码编译hadoop 2.2.0 搭建环境:Centos 6.4 64bit 1.安装JDK 参考这里2.安装mavenmaven官方下载地址,可以选择源码编码安装,这里就直接下载编译好的wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip解压文件后,同样在/etc/profie里配置环境变量vim /etc/profieexport

Python print报ascii编码异常的靠谱解决办法

之前遇到此异常UnicodeEncodeError: 'ascii' codec can't encode characters...,都是用这种方式解决:sys.setdefaultencoding('utf-8') 今天看到如下文章,阐述了此方式的弊端: http://blog.ernest.me/post/python-setdefaultencoding-unicode-bytes 但此文章只考虑了未使用第三方库的情况下的解决办法,而第三方库里如果也有print的话,就束手无策了,总不能

Hadoop常见异常及其解决方案

1.Shell$ExitCodeException 现象:运行hadoop job时出现如下异常: 14/07/09 14:42:50 INFO mapreduce.Job: Task Id : attempt_1404886826875_0007_m_000000_1, Status : FAILED Exception from container-launch: org.apache.hadoop.util.Shell$ExitCodeException: org.apache.hadoo

Ubuntu 编译安装 Linux 4.0.5 内核,并修复 vmware 网络内核模块编译错误

. . . . . 今天把 Ubuntu 14.04 升级到了最新的 4.0.5 的内核版本,本来不打算记录下来的,但是升级的过程中确实遇到了一些问题,所以还是记录下来,分享给遇到同样问题的猿友. 先去官网下载最新的内核压缩包:https://www.kernel.org/ 网速不给力,只能用虚拟机里的迅雷下载,然后再拷贝出来. LZ 把源码包拷贝到 /usr/src 下面,直接就在这里编译安装了: # 切换到 root 身份 >$ su # 解压缩源码,得到文件夹 /usr/src/linux