Operating System - HP-UX
1752579 Members
3989 Online
108788 Solutions
New Discussion юеВ

Re: g++ - static => shl_load unsatisfied symbols

 
T Bruns
Advisor

g++ - static => shl_load unsatisfied symbols

hello

i hava a problem.

i try to compile a programm with "-static" and then the linker come back with this error:

/usr/css/bin/ld: unsatisfied symbols
shl_load (first referenced in /usr/lib/libc.a(setlocale.o))
/usr/css/bin/ld: unsatisfied symbols
shl_unload (first referenced in /usr/lib/libc.a(setlocale.o))
/usr/css/bin/ld: unsatisfied symbols
shl_findsym (first referenced in /usr/lib/libc.a(setlocale.o))

HP-UX B 11.11
g++ 3.2

Libraries:
Xm, xerces-c Xt X11 Xp Xext phtread

Greetings
Thomas
12 REPLIES 12
Dennis Handly
Acclaimed Contributor

Re: g++ - static => shl_load unsatisfied symbols

That's correct. You can't use -static if you want to dynamically load something.
In order to use setlocale(3) and a bunch of networking functions, you must link with -l:libdld.sl.
T Bruns
Advisor

Re: g++ - static => shl_load unsatisfied symbols

mmhh that is not what i want :-(

i want some application which is fully linked static.

Background is, we produce on a HPUX PA-Risc and linked it fully static for an itanium Intel 64Bit.

Also we need all libs static :-(

Is there any way to do this?

thx
Andre-Marcel Hellmund
Frequent Advisor

Re: g++ - static => shl_load unsatisfied symbols

Hey Thomas,

> Also we need all libs static :-(

I think that could become difficult to get all required libraries as static ones.

As Dennis mentioned, some libraries should/must be shared because they a very specific for the system the run on (e.g. libnss). By the way, it is a bad idea to build a completely statically linked application (you may find some of these arguments useful: http://people.redhat.com/drepper/no_static_linking.html).

If you build your application on a PA-RISC system, you must have already set up your build environments with static/shared libraries and include header files for Itanium systems? Why don't you then just use the shared libraries? Probably the --sysroot option is useful for your case?

Best regards,
Andi
Dennis Handly
Acclaimed Contributor

Re: g++ - static => shl_load unsatisfied symbols

>I want some application which is fully linked static.

On IPF you can't do that since only libc.so is provided.

>we produce on a HP-UX PA-RISC and linked it fully static for Integrity.

You said you have done this before or it is failing now?

>Also we need all libs static :-(

You can only do this on PA and if you do, you must stub out setlocale and anything else that calls dlopen/shl_load. Or you must use static libs for all of your contributions but leave system libs as shlibs.
T Bruns
Advisor

Re: g++ - static => shl_load unsatisfied symbols

Hello ANdi

mmhh i don't now exactly if we need the itanium libs. Our point is we use the compatibility mode from the Itanium to run the APP, so we don't need the Itanium lib(?).

therefore i think we need the HPUX libs as static?

sorry for my english.

thx
T Bruns
Advisor

Re: g++ - static => shl_load unsatisfied symbols


>On IPF you can't do that since only libc.so >is provided.
it means that on the IPF the libc.so is provided and we don't link it static?

and the dld?


>You said you have done this before or it is >failing now?

now, is a new project.

>You can only do this on PA and if you do, >you must stub out setlocale and anything >else that calls dlopen/shl_load. Or you >must use static libs for all of your >contributions but leave system libs as >shlibs.

ok i try this, but i don't find the flag for this option by gcc :-(
which flag is it?

thx
Dennis Handly
Acclaimed Contributor

Re: g++ - static => shl_load unsatisfied symbols

>I think we need the HP-UX libs as archive?

No, it means you need to copy your non-system PA shlibs to your IPF box.
Or you link your non-system libs as archive and the rest shared.
Dennis Handly
Acclaimed Contributor

Re: g++ - static => shl_load unsatisfied symbols

>I don't find the flag for this option by gcc :-( which flag is it?

There isn't any for a foreign devil compiler. If you were using aC++, you would just use +A.

So you have to invent your own stubs.
Andre-Marcel Hellmund
Frequent Advisor

Re: g++ - static => shl_load unsatisfied symbols

Hey Thomas,

okay, sorry, then I just misunderstood you. I thought you were doing some cross-compiling on PA ...

You could check this page (http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801/?ciid=0208713ba4f02110713ba4f02110275d6e10RCRD) about ARIES ... I think you don't need the application to be linked statically to use ARIES.

See the example below

PA-RISC build:
hs0040:c5122564> uname -a
HP-UX hs0040 B.11.11 U 9000/800 151414671 unlimited-user license
hs0040> /opt/aCC/bin/aCC -Ae test.c -o test
hs0040> ./test
PA-RISC
hs0040> /usr/ccs/bin/ldd test
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
hs0040> file /usr/lib/libc.2
/usr/lib/libc.2: PA-RISC2.0 shared library -not stripped

Itanium run:
hs0138> ./test
PA-RISC