Linkage Problem on Solaris

Linkage Problem on Solaris

Post by John B. Loren » Sat, 10 Nov 2001 03:04:39

I am linking a number of libraries in a compilation process and one of the
libraries is not being recognized.  The files and directories for the
libraries are as follows:


This is the long hand version of the command I am using.

cc -dn -o cmpsimpl cmpsimpl.o -L /lor/et1002 -L /usr/lib -lm -lcmp -ldl

The error I am getting is:

ld: fatal: library -ldl: not found
ld: fatal: File processing errors.  No output written to cmpsimpl

For some reason the is not recognized and I have double checked to
see if the file is in the /usr/lib.  If anyone has any ideas Id appreciater
your help.

John Lorenz


Linkage Problem on Solaris

Post by Casper H.S. Dik - Network Security Engine » Sat, 10 Nov 2001 03:52:49


Quote:>This is the long hand version of the command I am using.
>cc -dn -o cmpsimpl cmpsimpl.o -L /lor/et1002 -L /usr/lib -lm -lcmp -ldl


You're trying static linking; -ldl requires dynamic linking.

Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.


1. dlopen() on SunOS, strange ld linkage problem

If anyone has used dlopen() successfully please send comments to me at

chance that I won't get your comments!

I'm trying to use dlopen(), dlsym() and dlclose() to dynamically link
objects into my program.  The loader ld produces a very strange executable
when I link with /usr/lib/  When I disassemble the instructions
for dlopen() (from within gdb) there are two "call" instructions, at
<dlopen+32> and <dlopen+40>, that refer to addresses at offsets of
0x21ac and 0x21b0.  For example,

   0x2320 <dlopen+32>: call 0x4364
   0x2328 <dlopen+40>: call 0x4370

Now here's the weird part.  These offsets are in whatever text segment
happens to follow dlopen by the right amount.  They don't change according
to the link order, and don't appear to have any relationship to the text
segment into which they point.

Needless to say, the program does not execute correctly, since dlopen()
shouldn't jump into whatever this text segment happens to be.

Does anyone know what is going on here, or how to resolve this situation?


Computation & Neural Systems Program
California Institute of Technology, 216-76
Pasadena, CA 91125

2. silo overflows on inactive port?

3. linkage problem , dynamic libraries

4. 4 CYCLOM-16Y/DB25 card in a system, possible?

5. linkage problem with dl etc under apache

6. How NIS update the clients after a passwd change?

7. Problem: shared object loading runs constructor of a static object, but static linkage does not.

8. Morse Telecommunications - Sleazeballs

9. *.so Linkage problem

10. linkage problem with libCstd.a

11. linkage problem with dl etc under apache

12. gcc/g++ linkage problem

13. Linkage problem