WARN util.NativeCodeLoader: 編譯hadoop2.5

WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: `./in': No such file or directory
緣由查找:
[root@db96 hadoop]# file /usr/local/hadoop/lib/native/libhadoop.so.1.0.0 
/usr/local/hadoop/lib/native/libhadoop.so.1.0.0: ELF 32-bit LSB shared object, 
 Intel 80386, version 1 (SYSV), dynamically linked, not stripped

是32位的hadoop,安裝在了64位的linux系統上。lib包編譯環境不同,因此不能使用。
悲劇了。
解決辦法:從新編譯hadoop.

java

1.安裝maven,下載並解壓。
http://maven.apache.org/download.cgi  //下載對應的壓縮包
apache-maven-3.2.1-bin.tar
[root@db99 ~]# tar -zxvf apache-maven-3.2.1-bin.tar

[root@db99 ~]# ln -s /usr/local/apache-maven-3.2.1/ /usr/local/maven
[root@db99 local]# vim /etc/profile  //添加環境變量中
export MAVEN_HOME=/usr/local/maven
export PATH=$MAVEN_HOME/bin:$PATH 
linux

mvn -version apache

2.protobuf的安裝
https://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.5.0.tar.gz
下載:protobuf-2.5.0.tar.gz  並解壓
[root@db99 protobuf-2.5.0]# pwd
/root/protobuf-2.5.0
[root@db99 protobuf-2.5.0]# ./configure --prefix=/usr/local/protoc/
[root@db99 protobuf-2.5.0]# make
[root@db99 protobuf-2.5.0]# make check
[root@db99 protobuf-2.5.0]# make install
[root@db99 protobuf-2.5.0]# protoc --version
libprotoc 2.5.0
安裝成功。
vim

protoc --version app

3.ant安裝
首先下載ant
apache-ant-1.9.4-bin.tar.gz


[root@db99 local]# vim /etc/profile  //添加環境變量中
export ANT_HOME=/usr/local/ant
export PATH=$ANT_HOME/bin:$PATH 

 
jsp

4.編譯hadoop2.5
上面準備工做已經作的差很少了,咱們終於能夠開始,記得進入src文件夾下,輸入下面命令

mvn package -Pdist,native -DskipTests -Dtar  

..............編譯須要較長時間大概1個小時左右。
在目錄~/hadoop-2.5.0-src/hadoop-dist/target下有文件:
hadoop-2.5.0.tar.gz
問題總結:
這裏還須要在補充:
1.遇到錯誤1:CMake沒有安裝
maven

  1. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-

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

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

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

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

  6. -> [Help 1]
  7. [ERROR] 
  8. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e 

  9. switch.
  10. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  11. [ERROR] 
  12. [ERROR] For more information about the errors and possible solutions, please 

  13. read the following articles:
  14. [ERROR] [Help 1] 

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


解決方法:
CMake沒有安裝 oop

  1. sudo yum install cmake

或則使用 ui

  1. sudo apt-get install cmake


2.遇到錯誤2:ant沒有安裝 google

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

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

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

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

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

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

  7. ant/ant/1.6.5/ant-1.6.5.jar from central failed: Read timed out -> [Help 1]
  8. [ERROR] 
  9. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e 

  10. switch.
  11. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  12. [ERROR] 
  13. [ERROR] For more information about the errors and possible solutions, please 

  14. read the following articles:
  15. [ERROR] [Help 1] 

  16. http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
  17. [ERROR] 
  18. [ERROR] After correcting the problems, you can resume the build with the command
  19. [ERROR]   mvn <goals> -rf :hadoop-hdfs

解決辦法:

tar zxvf  apache-ant-1.9.4-bin.tar.gz
配置文件:
vi /etc/profile 生效 source  /etc/profile 檢驗 ant -version

相關文章
相關標籤/搜索