Operating System - HP-UX
1834020 Members
3038 Online
110063 Solutions
New Discussion

shl_load unresolved linking with archive libraries

 
David Johns
Advisor

shl_load unresolved linking with archive libraries

I'm trying to compile a stand-alone application by passing the HP C compiler the '-Wl,-a archive' option. The link fails:
/usr/ccs/bin/ld: Unsatisfied symbols:
shl_load (code)
shl_unload (code)
shl_findsym (code)

Are these the correct compiler flags for HP-UX 11.11, PA1.X, HP-C? (I'd like to avoid linking with libdld.sl!)

Thanks,
Dave
5 REPLIES 5
Steve Steel
Honored Contributor

Re: shl_load unresolved linking with archive libraries

Hi

Thjese are coming from dld.sl for DNSS and you have no choice I am afraid


Steve steel
If you want truly to understand something, try to change it. (Kurt Lewin)
David Johns
Advisor

Re: shl_load unresolved linking with archive libraries

Steve:

Thanks for the reply. I'm unclear on DNSS, is that Domain Name Service? A function like gethostbyname would only be in libc.sl and not libc.a? Is this a feature, or a bug?

Thanks,
Dave

Olav Baadsvik
Esteemed Contributor

Re: shl_load unresolved linking with archive libraries


Hi,

This has nothing to do with gethostbyname etc
The libdld.sl is used by loader when
you start a program to link in shared
libs your program uses.
Check if your program has calls to shl_load
etc. If not, I guess you have trivial
error in your compiler/linker command.
To minimize uncertain factors you could start
with dropping the -Wl,-a archive option
to the compiler.

Regards
Olav
David Johns
Advisor

Re: shl_load unresolved linking with archive libraries

Hi Olav:

I think Steve is correct, the resolver routines reference shl_load, etc.

/usr/ccs/bin/ld: Unsatisfied symbols:
shl_load (first referenced in /usr/lib/libc.a(gethostent.o)) (code)
shl_findsym (first referenced in /usr/lib/libc.a(gethostent.o)) (code)

A sample program is listed in the man page for gethostent. I can't compile this without shared libraries.

I'm trying to compile NTP so it will run on HP-UX 10.X and 11.X. It was suggested that I build it without shared libraries, hence my current predicament.

Thanks,
Dave
David Johns
Advisor

Re: shl_load unresolved linking with archive libraries

On HP-UX 11.11 the man page for gethostent has the following warning.

WARNINGS
Programs that use the interfaces described in this manpage cannot be
linked statically because the implementations of these functions
employ dynamic loading and linking of shared objects at run time.