Reputation: 45
Error while loading shared libraries: libclntsh.so.11.1 : cannot open shared obj file no such file. When running from crontab.
I complied my c++ program, its a proc program after compiling proc I will run the below command.
g++ filename.CPP -I $ORACLE_HOME/precomp/public -L $ORACLE_HOME/lib -lclntsh -o test
I created a crontab to run it every min
$ crontab -l
* * * * * /home/test > /home/te.txt 2>&1
I made a symbolic link of that library. But I'm getting above error inside te.txt
Im searching this for past 2 days and also went through the similar question, but still I not able to clear the error.
I'm not sure with LD_Library_path
or .bash_profile
. how to include that library.
Upvotes: 0
Views: 14301
Reputation: 5298
If you are on Linux (using GNU Binutils) you can also compile-in the library path directly into the binary. See -Wl,-rpath=...
But anyway (unless you use Oracle instant client lib) you should also export ORACLE_HOME env. var in crontab. Otherwise your application will not by able to localize .nls nor .ora (tnsnames.ora) files.
Upvotes: 0
Reputation: 5816
Your can export library path in your .bash_profile like
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
or you can copy your libclntsh.so in /usr/lib/ or /lib
Upvotes: 4