Operating System - Linux
1752292 Members
4526 Online
108786 Solutions
New Discussion юеВ

Re: Problem loading library with shl_load (hpux 11-23/ia64)

 
SOLVED
Go to solution
Yair Carel
New Member

Problem loading library with shl_load (hpux 11-23/ia64)

$ uname -a
HP-UX itahp B.11.23 U ia64 2910282009 unlimited-user license

I'm trying to load a library using the following command
libraryHandle = shl_load( library, BIND_FIRST | BIND_DEFERRED | DYNAMIC_PATH, 0L );

(gdb) p library
$2 = 0x600000000001fb20 "/opt/BMCS/mq/bin/AMQAMP00"

This fails with errno=2
(gdb) p errno
$1 = 2
from errno.h:
#define ENOENT 2 /* No such file or directory */

if I try to ls the file there is no problem and also if I try to read its content:

ls -la /opt/BMCS/mq/bin/AMQAMP00
-rwxr-xr-x 2 patrolmq mqm 21552 Jun 25 19:45 /opt/BMCS/mq/bin/AMQAMP00

$ file /opt/BMCS/mq/bin/AMQAMP00
/opt/BMCS/mq/bin/AMQAMP00: ELF-64 shared object file - IA64

The path is built from a few links
/opt/BMCS/mq -> /home/patrolmq/common/mq
/opt/BMCS/mq/bin/AMQAMP00 -> HPUX11/AMQAMP00

I have no idea what is wrong. I tried to copy the file to some other location without any link to the file (/home/patrolmq) and it didn't help.

Were should I go from here?
9 REPLIES 9
Dennis Handly
Acclaimed Contributor

Re: Problem loading library with shl_load (hpux 11-23/ia64)

>This fails with errno=2

It is illegal for you you to look at errno unless libraryHandle is NULL. Otherwise you may get some stale errno value.

If you want more details on errors, OR in BIND_VERBOSE.

Also, any reason you aren't using dlopen(3) on IPF?
Yair Carel
New Member

Re: Problem loading library with shl_load (hpux 11-23/ia64)

The libraryHandle is indeed NULL only then I look at the value of errno.
The reason I use shl_load is because this is old code that i'm porting from PA-RISC to itanium.
Anyway I will try now using dlopen.
Thanks a lot from you quick answer.
I will let you know what happened after the change to dlopen.
Dennis Handly
Acclaimed Contributor
Solution

Re: Problem loading library with shl_load (hpux 11-23/ia64)

>The libraryHandle is indeed NULL only then I look at the value of errno. The reason I use shl_load is because this is old code that I'm porting from PA-RISC to Integrity.

Ok, I assumed the answer was easy.

>Anyway I will try now using dlopen.

Before you do that, try with BIND_VERBOSE. You may be getting the errors on dependent shlibs.
I.e. what does "chatr AMQAMP00" show?
Yair Carel
New Member

Re: Problem loading library with shl_load (hpux 11-23/ia64)

chatr /opt/BMCS/mq/bin/AMQAMP00
-------------------------------
/opt/BMCS/mq/bin/AMQAMP00:
64-bit ELF shared library
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third .:/opt/BMCS/mq/bin:/opt/mqm/lib:/usr/ucblib:/usr/ccs/lib:/usr/lib
shared library list:
libamq.so
shared vtable support disabled
explicit unloading enabled
segments:
index type address flags size
6 text 4000000000000000 z---c- D (default)
7 data 6000000000000000 ---m-- D (default)
kernel assisted branch prediction enabled
lazy swap allocation for dynamic segments disabled
nulptr references disabled
address space model: default
caliper dynamic instrumentation disabled
Dennis Handly
Acclaimed Contributor

Re: Problem loading library with shl_load (hpux 11-23/ia64)

>embedded path enabled third .:/opt/BMCS/mq/bin:/opt/mqm/lib:/usr/ucblib:/usr/ccs/lib:/usr/lib
>shared library list: libamq.so

So where is libamq.so?
In /opt/BMCS/mq/bin:/opt/mqm/lib:/usr/ucblib?
/usr/ccs/lib:/usr/lib are not valid. The former because there are no libs there. The latter because this is a PA32 path.
Steven E. Protter
Exalted Contributor

Re: Problem loading library with shl_load (hpux 11-23/ia64)

Shalom,

Either the file needed is not there at all or it may be corrupt.

if its there compare it to a library of the same name and location on a working system.

I've seen a few circumstances where an oracle library was sitting on an unlucky part of the disk where the size suddenly changed and we out of the blue could not compile or start oracle.

Such corruption could be the case here.

Good Luck

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Yair Carel
New Member

Re: Problem loading library with shl_load (hpux 11-23/ia64)

Well indeed the libamq.so was missing, I created a link to it in its location
/opt/BMCS/mq/bin/libamq.so -> /opt/BMCS/mq/bin/HPUX11/libamq.so

But still this doesn't help.

I'm now testing with the BIND_VERBOSE flag, and will also try the dlopen
Dennis Handly
Acclaimed Contributor

Re: Problem loading library with shl_load (hpux 11-23/ia64)

>Well indeed the libamq.so was missing

You may need to recursively apply chatr on your shlib to find all dependent shlibs.
You can also use ldd(1) to get the all at once. But unfortunately it stops on the first missing one, where chatr(1) just lists them where they should be.
Steven E. Protter
Exalted Contributor

Re: Problem loading library with shl_load (hpux 11-23/ia64)

Shalom,

Its restore or reinstall the product time. If this ever worked, and you have backups, you should be able to install/restore and verify the contents of the missing folder.

Where one library is missing, there are probably other ones missing.

If you have a similar system you may be able to shortcut the process with an scp -p of a directory or two.

To be safe though reinstall of the depots/sources of the software is my recommendation.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com