由于2.4.0默认配置的libhadoop是32位的,在64位的操作系统环境运行过程中,会提示以下错误:
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /opt/hadoop-2.2.0/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
13/11/01 10:58:59 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
需要重新编译Hadoop的代码,得到适合的库文件。按以下步骤执行。
可以从Apache官方下载Hadoop 2.2.0的源代码,或者在以下网址下载Hadoop 2.2.0的源代码:
本文采用的Ubuntu 12.04.3 LTS环境,先安装编译环境:
[plain] view plain copy print?
$ yum install
yum install gcc gcc-c++ kernel-devel
$ yum install g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev
安装 build-essential
yum groupinstall "Development Tools"
这时候需要用wget命令去网络上下载资源包
wget -O /etc/yum.repos.d/epel-apache-maven.repo
然后重新安装maven
安装maven
yum -y install apache-maven
配置protobuf编译过程需要使用protobuf,建议先行安装。Ubuntu仓库默认的protobuf是2.4.1版,需要最新的2.5版:
https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
下载解压后,执行:
[plain] view plain copy print?
$ tar xzvf protobuf-2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./configure --prefix=/usr
$ make
$ sudo make install
编译hadoop解压进入hadoop源码目录,执行编译:
[plain] view plain copy print?
$ tar xzvf hadoop-2.2.0-src.tar.gz
$ cd hadoop-2.2.0-src
$ mvn package -Pdist,native -DskipTests -Dtar
编译过程中maven会自动下载依赖。编译完成后,系统会提示以下信息:
[plain] view plain copy print?
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------
[INFO] Total time: 15:39.705s
[INFO] Finished at: Fri Nov 01 14:36:17 CST 2013
[INFO] Final Memory: 135M/422M
然后在以下目录可以获取编译完成的libhadoop:
[plain] view plain copy print?
hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/lib
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。