Operating System - HP-UX
1833526 Members
3138 Online
110061 Solutions
New Discussion

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

 
Kwang Tan
Advisor

/usr/ccs/bin/ld: Can't find library: "clntsh"

The OS I'm using is "HP-UX v11.11 (64-bit)".

In it I run the following line:
$ cc try.c -noshared +DA1.1 -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -lclntsh

which then gives
/usr/ccs/bin/ld: Can't find library: "clntsh"


The environment in which I run the 'cc' command:
$ echo $SHLIB_PATH
/app/app/oracle/product/10.1.0/lib32
$ echo $LD_LIBRARY_PATH
/app/app/oracle/product/10.1.0/lib
$ ll $ORACLE_HOME/lib/libclntsh.*
lrwxrwxr-x 1 oracle dba 17 Jan 3 18:43 /app/app/oracle/product/10.1.0/lib/libclntsh.sl -> libclntsh.sl.10.1
-rwxr-xr-x 1 oracle dba 19105640 Jan 3 18:42 /app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1
$


Could anyone please point out for me what I've missed out such that I get the "Can't find library" error message? Thank-you.
24 REPLIES 24
Arunvijai_4
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hello, What does # file /app/app/oracle/product/10.1.0/lib/libclntsh.sl and # ldd /app/app/oracle/product/10.1.0/lib/libclntsh.sl

give? Export SHLIB_PATH=$SHLIB_PATH:/app/app/oracle/product/10.1.0/lib/

will help you.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Senthil Prabu.S_1
Trusted Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi,
export LD_LIBRARY_PATH=/app/app/oracle/product/10.1.0/lib:$LD_LIBRARY_PATH.
This should solve your problem.


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Arun and Prabu

Thanks for looking into the problem. I've done the following:

$ export SHLIB_PATH=$SHLIB_PATH:/app/app/oracle/product/10.1.0/lib/
$ export LD_LIBRARY_PATH=/app/app/oracle/product/10.1.0/lib:$LD_LIBRARY_PATH
$ echo $SHLIB_PATH
/app/app/oracle/product/10.1.0/lib32:/app/app/oracle/product/10.1.0/lib/
$ echo $LD_LIBRARY_PATH
/app/app/oracle/product/10.1.0/lib:/app/app/oracle/product/10.1.0/lib
$ cc try.c -noshared +DA1.1 -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -lclntsh
/usr/ccs/bin/ld: Can't find library: "clntsh"

As for Arun's request, here it is:
$ file /app/app/oracle/product/10.1.0/lib/libclntsh.sl
/app/app/oracle/product/10.1.0/lib/libclntsh.sl: ELF-64 shared object file - PA-RISC 2.0 (LP64)
$ ldd /app/app/oracle/product/10.1.0/lib/libclntsh.sl
libnnz10.sl => /app/app/oracle/product/10.1.0/lib/libnnz10.sl
librt.2 => /lib/pa20_64/librt.2
libpthread.1 => /lib/pa20_64/libpthread.1
libnss_dns.1 => /lib/pa20_64/libnss_dns.1
libdl.1 => /lib/pa20_64/libdl.1
libm.2 => /lib/pa20_64/libm.2
libc.2 => /lib/pa20_64/libc.2
libcl.2 => /lib/pa20_64/libcl.2
libdl.1 => /usr/lib/pa20_64/libdl.1
libdl.1 => /usr/lib/pa20_64/libdl.1
$

@@ Kwang
Arunvijai_4
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi,

You are trying to compile with +DA1.1 which in turn produces 32 bit objects and you are trying to link it with 64 bit /app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1. It wont happen aytiime. Either you have to find 32 bit library or you have to compile with +DA2.0 option to generate 64 bit objects.

Hope this is clear.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Vibhor Kumar Agarwal
Esteemed Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Try one more thing:

Append the following

-L/app/app/oracle/product/10.1.0/lib -lclntsh
Vibhor Kumar Agarwal
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Vibhor, I've now included the full path to the library directory.

Hi Arun, thanks for pointing "+DA1.1" out. I've tried both one with "+DA2.0" and another without any "DA"s. Yes I do wish to compile a 62-bit program.

$ echo $SHLIB_PATH
/app/app/oracle/product/10.1.0/lib32:/app/app/oracle/product/10.1.0/lib/
$ echo $LD_LIBRARY_PATH
/app/app/oracle/product/10.1.0/lib:/app/app/oracle/product/10.1.0/lib
$
$ cc try.c -noshared -I/app/app/oracle/product/10.1.0/precomp/public -L/app/app/oracle/product/10.1.0/lib -lclntsh
/usr/ccs/bin/ld: Can't find library: "clntsh"
$ cc try.c -noshared +DA2.0 -I/app/app/oracle/product/10.1.0/precomp/public -L/app/app/oracle/product/10.1.0/lib -lclntsh
/usr/ccs/bin/ld: Can't find library: "clntsh"
$

@@ Kwang
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Just a note, this ia a total new HP system in which I'm trying to compile 'try.c' program.
Arunvijai_4
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

One more try out, # chatr /app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1

What does it give ?

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Arunvijai_4
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

In Addition, # what `which cc`

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Senthil Prabu.S_1
Trusted Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi,
I guess the problem is that,it is not able to find the library.


So, try $ cc try.c -noshared +DA1.1 -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -l /app/app/oracle/product/10.1.0/lib/libclntsh.sl
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Arun

Here are the information:

$ chatr /app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1
/app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1:
64-bit ELF shared library
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third /app/app/oracle/product/10.1.0/lib
internal name:
libclntsh.sl.10.1
shared library list:
libnnz10.sl
librt.2
libpthread.1
libnss_dns.1
libdl.1
libm.2
libc.2
libcl.2
shared library mapped private disabled
shared vtable support disabled
explicit unloading enabled
linkage table protection disabled
segments:
index type address flags size
5 text 4000000000000000 z---c- D (default)
6 data 8000000100000000 ---m-- D (default)
static branch prediction disabled
kernel assisted branch prediction enabled
lazy swap allocation for dynamic segments disabled
nulptr references enabled
$ which cc
/usr/bin/cc
$ file /usr/bin/cc
/usr/bin/cc: PA-RISC1.1 shared executable dynamically linked
$ ll /usr/bin/cc
lr-xr-xr-t 1 root sys 17 Dec 30 17:29 /usr/bin/cc -> /opt/ansic/bin/cc
$ file /opt/ansic/bin/cc
/opt/ansic/bin/cc: PA-RISC1.1 shared executable dynamically linked
$

@@ Kwang
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Prabu

I've also tried the line you gave:

$ cc try.c -noshared +DA1.1 -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -l /app/app/oracle/product/10.1.0/lib/libclntsh.sl
/usr/ccs/bin/ld: Can't find library: "/app/app/oracle/product/10.1.0/lib/libclntsh.sl"
$

@@ Kwang
Vibhor Kumar Agarwal
Esteemed Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

There is definetly some problem with the path.

Are you sure you are giving the right path.

Your latest lib is /app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1

Is there a link named libclntsh.sl pointing to the above one in the same directory.
Vibhor Kumar Agarwal
Arunvijai_4
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi,

Is /app/app/oracle/product/10.1.0/lib/ a NFS mounted dir ? also, you should n't try to compile with +DA1.1 since it is for generating 32 bit objects and you want 64 bit.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Sandman!
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hello Kwang,

The options to cc are okay with the exception of the "-noshared" switch. This causes cc to use archive instead of shared libraries (ones that are suffixed *.sl). So unless you have an archive library (one that ends in *.a) in the library path specified with the "-L" switch, cc will keep complaining. Suggest you revise the options to cc as follows:

# cc try.c +DA1.1 -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -lclntsh

Basically removing the "-noshared" option to cc should give you a successful compilation.

cheers!
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Vibhor

Yes, it is the latest library and the link are both found in:
$ ll /app/app/oracle/product/10.1.0/lib/libclntsh.*
lrwxrwxr-x 1 oracle dba 17 Jan 3 18:43 /app/app/oracle/product/10.1.0/lib/libclntsh.sl -> libclntsh.sl.10.1
-rwxr-xr-x 1 oracle dba 19105640 Jan 3 18:42 /app/app/oracle/product/10.1.0/lib/libclntsh.sl.10.1

@@ Kwang
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Arun

Acknowledge, I'll not use "+DA1.1". I've used one earlier when I was replying to Prabu.
BTW, "/app/app/oracle/product/10.1.0/lib/" is _not_ NFS mounted.

@@ Kwang
Sandman!
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Kwang,

Do a man on ld...man ld(1) which should shed more light on this stuff or search for it on docs.hp.com.

hope it helps!
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi people!

It's a successful compilation!

$ cc try.c +DA2.0W -I/app/app/oracle/product/10.1.0/precomp/public -L/app/app/oracle/product/10.1.0/lib -lclntsh
$ a.out
Thank-you to you Arun, Prabu, Vibhor and Sandman for helping out! :)
$

After this I'll be trying to compile other programs ;)

@@ Kwang
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Sandman

Could you reply an empty message to this thread? Thank-you.

@@ Kwang
Arunvijai_4
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Nice to hear that you have successfully completed your test assignment. Also, you can take down these options,

+DA2.0W - Compiles in 64-bit mode for the PA-RISC 2.0 architecture. The macros __LP64__ and _PA_RISC2_0 are #defined.

__LP64__ Macro that is automatically defined by the HP aC++ compiler when compiling in 64-bit mode. Can be used within conditional directives to isolate 64-lbit mode code.

+DD64 Recommended option for compiling in 64-bit mode on the PA-RISC 2.0 architecture. The macros __LP64__ and _PA_RISC2_0 are #defined. (Same as +DA2.0W.)

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Sandman!
Honored Contributor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

???Could you reply an empty message to this thread???
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Sandman, missed giving you the appropriate points when you advised me to exclude "-noshared".

@@ Kwang
Kwang Tan
Advisor

Re: /usr/ccs/bin/ld: Can't find library: "clntsh"

Hi Arun

Thanks for the recommendation.
I'll note down what you said. :) See ya!

@@ Kwang