Reputation: 91
I'm making a C program which is connecting a oracle DB. I have correctly installed the Oracle Instant Client and ocilib.
And I did compile the code without any error but when I executing the program I got following error.
./a.out: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory
If anyone know how to solve please write it Thank you.
Upvotes: 3
Views: 33682
Reputation: 11
You need to setup LD_LIBRARY
export LD_LIBRARY_PATH=/path/instantclient:$LD_LIBRARY_PATH
like
export LD_LIBRARY_PATH=/oracle/instantclient_21_4:$LD_LIBRARY_PATH
Upvotes: 1
Reputation: 91
Yes I solve it by adding a link of the library to the /usr/lib
.
using the following command.
sudo ln -s /home/INSTANT_CLIENT/lib/libclntsh.so.11.1 /usr/lib/libclntsh.so.11.1
Upvotes: 6
Reputation: 9422
Copied from my answer here: Eclipse CDT Auto Include Shared Libraries
Run ldconfig as root to update the cache - if that still doesn't help, you need to add the path to the file ld.so.conf (just type it in on its own line) or better yet, add the entry to a new file (easier to delete) in directory ld.so.conf.d.
Upvotes: 0
Reputation: 543
LIBPATH environment variable should be pointed to the lib32 folder which contains the libclntsh.
then you need to export LIBPATH variable before you run your application.
Upvotes: 0
Reputation: 335
Make sure the Examples CD is installed. Make sure environment variable LD_LIBRARY_PATH is set, and the library file is accessible (permission-wise) for the user who you are logged in as.
If you have checked these and still get the error, please post the output of:
strace ./a.out
Upvotes: 0