Compile a collection of errors when running hadoop C Interface example

Compile:

g++ hello_world.cpp -I${HADOOP_HOME}/include -L${HADOOP_HOME}/lib/native -lhdfs -L${JAVA_HOME}/lib/server -ljvm
The final run Java programs, so not only hdfs dynamic library, the library also need jvm
I installed the version of openjdk11,11 canceled after jre directory, the directory structure of the rectification again

Run error can not mount a dynamic library

  1. error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory
  2. error while loading shared libraries: libhdfs.so.0.0.0: cannot open shared object file: No such file or directory

Solution :

  1. Add dynamic link library to /etc/ld.so.conf.fthe
vim /etc/ld.so.conf.d/hdfs.conf
java的动态链接库路径$JAVA_HOME/lib/server
libhdfs的动态链接库路径$HADOOP_HOME/lib/native
(改成自己的目录就是了)
  1. Excuting an order:ldconfig -v
Published 83 original articles · won praise 100 · views 110 000 +

Guess you like

Origin blog.csdn.net/weixin_36888577/article/details/104700945