您好,登錄后才能下訂單哦!
由于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的源代碼:
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,建議先行安裝。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源碼目錄,執行編譯:
[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文件夾替換原本的即可。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。