Operating System - HP-UX
1836359 Members
2641 Online
110100 Solutions
New Discussion

Link error: g++ 3.0.2 - shl_load

 
Ed Day
Advisor

Link error: g++ 3.0.2 - shl_load

Hello,

I am trying to link an application program statically on an HP workstation running HP-UX 11.00 using g++ 3.0.2.

The application links fine dynamically. But when I try to add the -static flag (which I need to do), I get the following error:

/usr/ccs/bin/ld: Unsatisfied symbols:
shl_load (code)
shl_findsym (code)
collect2: ld returned 1 exit status
*** Error exit code 1

I checked the man page for shl_load and it suggested I use -ldld. But when I did so, I got a library not found error. I checked the installed libraries and found a static version of this library does not exist. Has anyone else run across this problem?

Regards,

Ed Day

1 REPLY 1
Hartmut Lang
Trusted Contributor

Re: Link error: g++ 3.0.2 - shl_load

Well i don't think it makes any sense to have dld as a static library. Since dld is the dynamic-loader responsible for loading shared-libraries. If don't have shared-libraries, you don't need dld.

Your problem is, that your code requests shared-libraries. The problem might be related to the libstdc++, which is the c++ library of the g++. Maybe this library has itself references to shared-libraries.
I made a short ("Hello world") program using iostream. When i link with the -static option, i get the unsatisfied symbols as you did.
When i change iostream to printf, linking with the -static option works, no unsatisfied symbols.

So i think, if you need libstdc++ (e.g. becuase you use iostream), you can not link with the -static option.
A solution might be, that you recompile the libstdc++ itself, using the -static option.

I'm not completely shure about all this. So take my remarks only as a hint.

Hartmut