0

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.

Pam
  • 41
  • 1
  • 1
  • 3
  • 1
    Did you do step 3 of [the installation instructions](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html])? Showing the compilation/linking commands you used might be helpful, as well as the relevant environment variables for your platform. – Alex Poole Jan 06 '16 at 11:03

5 Answers5

4

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
Pam
  • 41
  • 1
  • 1
  • 3
0

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

Vampiro
  • 345
  • 4
  • 15
0

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.

ManKeer
  • 545
  • 2
  • 6
  • 25
0

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.

Community
  • 1
  • 1
ralf htp
  • 8,673
  • 3
  • 20
  • 32
0

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
dossy
  • 1,547
  • 14
  • 24
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 23 '21 at 20:44