编译hadoop的libhdfs.a

进入hadoop-hdfs-project/hadoop-hdfs/src目录,执行cmake以生成Makefile文件。

如果遇到如下的错误:

~/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src]$ cmake .

JAVA_HOME=, JAVA_JVM_LIBRARY=/data/jdk/jre/lib/amd64/server/libjvm.so

JAVA_INCLUDE_PATH=/data/jdk/include, JAVA_INCLUDE_PATH2=/data/jdk/include/linux

Located all JNI components successfully.

CMake Error at CMakeLists.txt:84 (MESSAGE):

  You must set the CMake variable GENERATED_JAVAH

-- Configuring incomplete, errors occurred!

则指定一下cmake参数即可,如下所示:

cmake -DJAVA_HOME=/data/jdk -DGENERATED_JAVAH=/data/jdk .

然后带参数再次执行cmake:

~/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src]$ cmake -DJAVA_HOME=/data/jdk -DGENERATED_JAVAH=/data/jdk .

下面的显示表示cmake成功,会在当前目录下生成Makefile文件:

JAVA_HOME=/data/jdk, JAVA_JVM_LIBRARY=/data/jdk/jre/lib/amd64/server/libjvm.so

JAVA_INCLUDE_PATH=/data/jdk/include, JAVA_INCLUDE_PATH2=/data/jdk/include/linux

Located all JNI components successfully.

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.23") 

-- checking for module 'fuse'

--   package 'fuse' not found

-- Failed to find Linux FUSE libraries or include files.  Will not build FUSE client.

-- Configuring done

-- Generating done

-- Build files have been written to: /data/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src

接下来就可以执行make来编译生成libhdfs.a了。

上一篇:从零学习Flutter(一):初识Dart


下一篇:Java并发编程笔记之LinkedBlockingQueue源码探究