You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-user@hadoop.apache.org by il...@cs.wisc.edu on 2010/07/20 22:59:01 UTC
C API for HDFS
Hi,
I have two questions:
1) When I try to compile hdfs_test.c file that comes with 0.20.2
distribution, it gives following errors:
/usr/bin/ld: cannot find -lhdfs
collect2: ld returned 1 exit status
I used following command:
gcc hdfs_test.c -I${JAVA_LIB}/include -I${JAVA_LIB}/include/linux
-I${HADOOP_HOME}/src/c++/libhdfs -L${HADOOP_HOME}/libhdfs -lhdfs -o
hdfs_test
I am using gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
2) I need to access status of HDFS cluster from a C++ code, basically
almost same information we get by "bin/hadoop dfsadmin -report" command.
How can I manage that?
Thanks,
RE: C API for HDFS
Posted by weimin zhu <xi...@tsm.kddilabs.jp>.
Hi
> 1) When I try to compile hdfs_test.c file that comes with 0.20.2
> distribution, it gives following errors:
> /usr/bin/ld: cannot find -lhdfs
> collect2: ld returned 1 exit status
The cause is the libhdfs.so file doesn't exist in the environment variable
LD_LIBRARY_PATH.
Try the following command for amd64 architecture
gcc hdfs_test.c -I${JAVA_LIB}/include -I${JAVA_LIB}/include/linux
-I${HADOOP_HOME}/src/c++/libhdfs -L${HADOOP_HOME}/c++/Linux-amd64-64/lib
-lhdfs -o hdfs_test
for intel32 architecture
gcc hdfs_test.c -I${JAVA_LIB}/include -I${JAVA_LIB}/include/linux
-I${HADOOP_HOME}/src/c++/libhdfs -L${HADOOP_HOME}/c++/Linux-i386-32/lib
-lhdfs -o hdfs_test
> 2) I need to access status of HDFS cluster from a C++ code, basically
> almost same information we get by "bin/hadoop dfsadmin -report" command.
> How can I manage that?
I think you can manage that,because libhdfs only provides to a subset of the
HDFS APIs to manipulate DFS files and the filesystem
Unfortunately, administrative API does not include in libhdfs.
Of course ,you can create a issue on jira.
weimin zhu
> -----Original Message-----
> From: ilikhan@cs.wisc.edu [mailto:ilikhan@cs.wisc.edu]
> Sent: Wednesday, July 21, 2010 5:59 AM
> To: hdfs-user@hadoop.apache.org
> Subject: C API for HDFS
>
> Hi,
>
> I have two questions:
>
> 1) When I try to compile hdfs_test.c file that comes with 0.20.2
> distribution, it gives following errors:
>
> /usr/bin/ld: cannot find -lhdfs
> collect2: ld returned 1 exit status
>
> I used following command:
>
> gcc hdfs_test.c -I${JAVA_LIB}/include -I${JAVA_LIB}/include/linux
> -I${HADOOP_HOME}/src/c++/libhdfs -L${HADOOP_HOME}/libhdfs -lhdfs -o
> hdfs_test
>
> I am using gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
>
>
> 2) I need to access status of HDFS cluster from a C++ code, basically
> almost same information we get by "bin/hadoop dfsadmin -report" command.
> How can I manage that?
>
> Thanks,
>