Hi,
I have written a sample pro*c code and able compile and create a executable file without any error. But I have to run this binary in some other server by FTPing this binary to other server. The directory structure of ORACLE_HOME for both server is different. I used ORACLE_HOME as environmental variable. When I try to run the binary in the target server, it searching the library file in the directory structure of source server where I compiled.
Could you please help..!
Thanks
Akhirul
---------- Post updated at 02:09 AM ---------- Previous update was at 02:08 AM ----------
error:
/usr/lib/dld.sl: Can't open shared library: /apps2/hpux/oracle/10.2.0.2.0610/lib32/libclntsh.sl.10.1
---
source directory structure: /apps2/hpux/oracle/10.2.0.2.0610
target directory structure: /opt/oracle/10.2.0
Hi Akhirul,
Have you compiled it in target server? Or you have compiled it in source server and took the executable to target server and just ran that?
Regards
Shubham
Hi Subham,
I compile it in source server and run the binary in target server. In target server we don't have any compiler.
What commands was it compiled with?
Akhirul
December 6, 2012, 12:54pm
5
I have used the below command:
make -f demo_proc.mk build EXE=sample1 OBJS=sample1.o
demo_proc.mk: demo make file copied from oracle 8i with little modification.
binlib
December 7, 2012, 1:05pm
6
You probably need something like
SHLIB_PATH=$ORACLE_HOME/lib
export SHLIB_PATH
after you set your ORACLE_HOME to /opt/oracle/10.2.0 on the target server.
Akhirul
December 10, 2012, 7:45am
7
Hi,
I tried , but still the same issue.
Regards
Akhirul
Assume your compiled code filename is myprog
If you want meaningful help please show us the output of these commands on both computers:
uname -a
chatr myprog
echo $SHLIB_PATH
echo $ORACLE_HOME
Peasant
December 10, 2012, 9:23am
9
Try creating a symlink in /usr/lib/hpux32
ln -fs /oracle/lib32/libclntsh.so.10.1 /usr/lib/hpux32/libclntsh.so.10.1
Of course, the path to oracle libs on your server is different, so make that adjustemnt
Regards
Peasant.
Akhirul
December 11, 2012, 12:28am
10
Hi Jim,
I got the below output for your command:
Source machine:
$uname -a
HP-UX diana B.11.23 U 9000/800 408518640 unlimited-user license
$chatr sample1
sample1:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
shared library list:
dynamic /apps2/hpux/oracle/10.2.0.2.0610/lib32//libclntsh.sl.10.1
dynamic /apps2/hpux/oracle/10.2.0.2.0610/lib32//libnnz10.sl
dynamic /usr/lib/libcl.2
dynamic /usr/lib/librt.2
dynamic /usr/lib/libpthread.1
dynamic /usr/lib/libnss_dns.1
dynamic /usr/lib/libdld.2
dynamic /usr/lib/libnsl.1
dynamic /usr/lib/libm.2
dynamic /usr/lib/libc.2
shared library binding:
deferred
global hash table disabled
plabel caching disabled
global hash array size:1103
global hash array nbuckets:3
shared vtable support disabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled
shared library text merging disabled
$echo $SHLIB_PATH
../hpux:/chome/surinar/oms-c6.4.0/public/lib/hpux:/osmbuild/official/oms-c6.4.0/omsc640_399A/public/lib/hpux:/apps2/hpux/xercesc/2.7.0/lib:/apps2/hpux/qpthread/1.3.1/lib:/apps2/hpux/orbix_asp/6.3_SP1/shlib:/apps2/hpux/orbix_asp/6.3_SP1/shlib/default:/chome/surinar/osm_appl_dir_hpux/lib:/apps2/hpux/oracle/10.2.0.2.0610/lib32:/apps2/hpux/aCC/3.67/lib
$echo $ORACLE_HOME
/apps2/hpux/oracle/10.2.0.2.0610
Target machine:
$uname -a
HP-UX lotus B.11.23 U 9000/800 120414666 unlimited-user license
$chatr sample1
sample1:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
shared library list:
dynamic /apps2/hpux/oracle/10.2.0.2.0610/lib32//libclntsh.sl.10.1
dynamic /apps2/hpux/oracle/10.2.0.2.0610/lib32//libnnz10.sl
dynamic /usr/lib/libcl.2
dynamic /usr/lib/librt.2
dynamic /usr/lib/libpthread.1
dynamic /usr/lib/libnss_dns.1
dynamic /usr/lib/libdld.2
dynamic /usr/lib/libnsl.1
dynamic /usr/lib/libm.2
dynamic /usr/lib/libc.2
shared library binding:
deferred
global hash table disabled
plabel caching disabled
global hash array size:1103
global hash array nbuckets:3
shared vtable support disabled
explicit unloading enabled
runtime checks disabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled
shared library text merging disabled
$echo $SHLIB_PATH
/var/opt/lucent/patches:/opt/iona/shlib:/opt/iona/shlib/default:/opt/hpws/netegrity/siteminder/webagent/bin:/opt/hpws/apache/lib:/opt/hpws/apache/modules::/opt/oracle/10.2.0/lib32:/opt/lucent/platform/lib:/opt/qpthread/lib:/opt/iexpress/xercesc/lib:/opt/lucent/oms/lib:/usr/local/lib:/opt/lucent/cna/lib
$echo $ORACLE_HOME
/opt/oracle/10.2.0
Here is your problem on the target machine
The binary file wants:
/apps2/hpux/oracle/10.2.0.2.0610/lib32
SHLIB_PATH has
/opt/oracle/10.2.0/lib32
Show this to your sysadmin. One workaround is to create a symlink to allow the code to find /apps2/hpux/oracle under /opt
i.e.,
ln -s /opt /apps2/hpux
you can also do this on the source box in reverse, [modify ORACLE_HOME during compiling]
so that you do not have to change the target box. Check your code with chatr before sending it to the target.
ln -s /apps2/hpux /opt
Now you see why installing oracle in an unchanging directory name is good idea.
I have not been on HPUX for years, but I think ld has a +b option that creates relocatable library entry points based on SHLIB_PATH.
Anyway, go over the ld man page with a fine tooth comb - I think there is another way to deal with this other than symlinks.