Error while compiling krb 1.5
mdw at umich.edu
Mon Jul 10 22:04:06 EDT 2006
Theodore Tso <tytso at MIT.EDU> had replied to
"Henry B. Hotz" <hotz at jpl.nasa.gov>
> Date: Mon, 10 Jul 2006 19:43:20 -0400
> From: Theodore Tso <tytso at MIT.EDU>
> To: "Henry B. Hotz" <hotz at jpl.nasa.gov>
> Subject: Re: Error while compiling krb 1.5
> On Mon, Jul 10, 2006 at 04:22:35PM -0700, Henry B. Hotz wrote:
> > As someone noted, you can use libdl to access symbols in a statically
> > linked program.
> Err, no, you can't. dlopen() is only supported on dynamically linked
> programs. (This is true as far as I can tell for both Solaris and
> Linux, although for Solaris 10 Sun has effectively eliminated static
> linking by not providing libc.a anymore.)
I believe you're right for Solaris, and probably most "right thinking"
For Linux, (more precisely gnu libc) the truth is *far far* stranger.
If you link statically, but call "dlopen", a horrible glob of code
inside of your static copy of libc will reach out, mmap in your dynamic
library, and will then mmap a dynamic copy of libc.so since your
dynamic library probably claims it needs that, after which it will then
mmap in a dynamic copy of ld-linux.so, since libc.so claims it needs
that. I find the last part particularly baffling. Oh, and your minimal
sized "static" program to do all this is half a meg in size.
All this can happen even if you don't actually call dlopen directly; calling
"gethostbyname" is good enough. So here's a trivial example:
gh.diet is compiled with "diet cc". Same version of gcc, completely
different library (unfortunately, GPL'd).
More information about the krbdev