Hadoop2.4libhadoop.so的disabledstackguard问题
由于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
', 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的代码,得到适合的库文件。按以下步骤执行。
下载Hadoop 2.4.0 源代码
可以从Apache官方下载Hadoop 2.2.0的源代码,或者在以下网址下载Hadoop 2.2.0的源代码:
http://mirrors.cnnic.cn/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz
配置编译环境
本文采用的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 http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -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
注:默认源地址下,maven下载依赖时间极长,建议使用国内源,参考《maven国内镜像配置》文档。
然后将编译的lib/native文件夹替换原本的即可。
分享名称:Hadoop2.4libhadoop.so的disabledstackguard问题
转载来于:http://azwzsj.com/article/iijjsg.html