2

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
  • 71
  • 1
  • 1
  • 4
  • 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

5

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
  • 71
  • 1
  • 1
  • 4
1

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,617
  • 16
  • 26
  • 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
  • This worked for me in compiling a Pro*C program on OL 8 with Oracle DB client 19.16.0.0.0. – em_bo Dec 21 '22 at 19:20
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
  • 335
  • 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
  • 543
  • 2
  • 6
  • 27
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
  • 9,149
  • 4
  • 22
  • 34