After some C + + compiled, when run, the error said that the shared library could not be loaded, for example:
./write:error while loading shared libraries:libhdfs.so.0.0.0:cannot open Shared object file:no such file or directory
This error occurs because the compiled program needs to rely on a shared library while it is running, for example, the write executable needs to rely on a shared library called "libhdfs.so". (The difference between the dynamic link library and the static link library, please Baidu related documents)
There are two ways to solve the problem above, and any of the following two kinds can be:
First : Add the path to the shared library in/etc/profile:
Export Ld_library_path= $JAVA _home/jre/lib/amd64/server:/home/dcc/libhdfs
As above, add a two-way shared library, note that the road is separated by a colon (":").
Second : Add the path to the/etc/ld.so.conf and reload the shared library:
Vi/etc/ld.so.conf
Edited as follows:
Include ld.so.conf.d/*.conf
/home/dcc/libhdfs
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ amd64/server/
On, add two paths, one row for each path, respectively. When you are finished editing, reload the library:
/sbin/ldconfig-v
As for the difference between the two methods, I presume that the first one is loaded only when the C/s + + program is executed, and the second one should be for the entire system, which is loaded at boot time.