Operating System - HP-UX
1748209 Members
2750 Online
108759 Solutions
New Discussion юеВ

Can't open shared library

 
SOLVED
Go to solution
bivian
Advisor

Can't open shared library

If the loader gives following error
"Can't open shared library: ..."
what does it indicate?

The shared library has been linked with +s and +b options. The SHLIB_PATH has been set properly.
Is there anything else that is missing?
33 REPLIES 33
Dennis Handly
Acclaimed Contributor
Solution

Re: Can't open shared library

>"Can't open shared library:" what does it indicate?

Does it give a reason?

>Is there anything else that is missing?

Have you done the same to the executable?
What HP-UX version and architecture are you using?
bivian
Advisor

Re: Can't open shared library

No i don't see any reason.

I have done the same thing for executable also.

I am HPUX PARISC64. Following are details from uname command:
"HP-UX B.11.23 9000/800"
bivian
Advisor

Re: Can't open shared library

Just to add the executable and the shared library are both linked on one machine and are being used in another machine.
Dennis Handly
Acclaimed Contributor

Re: Can't open shared library

>No I don't see any reason.

No errno text in the message? What was the complete message?

What does "ldd executable" show?
You may have to use "tusc -fp -ea -o tusc.out executable" to trace what's happening.
bivian
Advisor

Re: Can't open shared library

I am not sure which executable is trying to load the shared library. The error message "Can't open shared library libclntsh.so" is logged into the log files.

tusc command shows some useful information.

From tusc.out i see that it finds the library in one location and open call succeeds. But later the open on the same library fails. tusc.out shows something like this:

.....
.....
[4268] open("/home/prash/lib32/libclntsh.sl", O_RDONLY, 0200) =
[4268] fstat(3, 0x77ff4748) .............................. = 0
[4268] read(3, "0210010e0512@ \0K i 5 s \0\0\0\0".., 128) = 128
[4268] lseek(3, 128, SEEK_SET) ........................... = 128
[4268] read(3, "10\0\004\0\0\0( \0c + d4\0\010\0".., 48) . = 48
[4268] read(3, "80\0\0\v\0\0\004\0\0\0\0", 12) ........... = 12
[4268] mmap(NULL, 6500352, PROT_READ|PROT_EXEC, MAP_SHARED|MAP_SHLIB, 3, 1757184
) = 0xcd400000
[4268] mmap(NULL, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOU
S|MAP_SHLIB, -1, 0) = 0x77ddd000
.....
....

[4336] open("/home/prash/lib32/libnmemso.sl", O_RDONLY, 0200) =
[4334] close(3638) ....................................... ERR#9 EBADF
[4336] fstat(3, 0x77ff49c8) .............................. = 0
[4334] close(3639) ....................................... ERR#9 EBADF
[4336] read(3, "0210010e0512@ \0K i 5 s \0\0\0\0".., 128) = 128


bivian
Advisor

Re: Can't open shared library

The second entry in tusc.out is also for libclntsh.so...
ranganath ramachandra
Esteemed Contributor

Re: Can't open shared library

Please attach the complete tusc trace that you get from
tusc -s open,read,close,mmap,munmap,stat,fstat -fp -ea -o tusc.out executable
 
--
ranga
[i work for hpe]

Accept or Kudo

Dennis Handly
Acclaimed Contributor

Re: Can't open shared library

>I am not sure which executable is trying to load the shared library.

It should be obvious. You should know your application. And tusc will tell you:
tusc -fp -ea -o tusc.out application ...
(Are you using threads?)

>But later the open on the same library fails.

This isn't really later on, this is a separate process. And the shlib is different.

>[4268] open("/home/prash/lib32/libclntsh.sl", O_RDONLY, 0200) =

(Please make sure you provide the return values.)

[4336] open("/home/prash/lib32/libnmemso.sl", O_RDONLY, 0200) =
[4334] close(3638) . ERR#9 EBADF
[4336] fstat(3, 0x77ff49c8) . = 0
[4334] close(3639) . ERR#9 EBADF
[4336] read(3, "0210010e0512@
> The second entry in tusc.out is also for libclntsh.so.

Huh? It says libnmemso.sl.

Are these PIDs or thread IDs?
bivian
Advisor

Re: Can't open shared library

Sorry for the delayed reply..

I have run the command "tusc -s open,read,close,mmap,munmap,stat,fstat -fp -ea -o tusc.out" on the process id.
It gives out a huge file which i cannot paste here.
Can you please tell me what parts of the file i need to paste.