Bugtraq mailing list archives

Re: a point is being missed


From: Doug.Hughes () Eng Auburn EDU (Doug Hughes)
Date: Sat, 4 Nov 1995 14:24:28 -0600


------=------=------=------=------=------=------=------=------=------

   In Solaris 2.x static linking is not supported for any of the
   system libraries.  All the functions that use /etc/nsswitch.conf
   (getXXXbyYYY, getpwXXX, etc) require the dynamic linker to
   load the code to load these functions.  It is not possible
   to write configurable/extensible functions in such a way that
   dynamic linking is not required.  E.g., you can add your own
   nsswitch.conf backend which would not be known to programs
   statically linked to only the standard backend code.

------=------=------=------=------=------=------=------=------=------


This recently drove a co-worker and I to the brink of insanity when we
tried statically linking "ls" for our anonymous FTP site on a Solaris
2.4 machine.

Seems like Solaris won't be able to handle this then, no?

--john


It's not supported, but you CAN do it. Just make some stubs for
_dlopen, _dlcose, and _dlsym that do the appropriate thing and
link them in. I have a statically compiled version of ls (ported
from NetBSD) that I use on our FTP server without any problems
at all.

Here's the code for those that are confused. Just link this in
with your executable. It isn't supported, but so !@%#% what. When
you need it, you need it. I just wish they'd change their position
on this.

#include <stdio.h>

int dlclose(void *handle)
{return 0;}

void *dlsym(void *handle, const char *name)
{return NULL;}

void *dlopen(const char *pathname, int mode)
{return NULL;}


Link this in with your ls to make it static.

Note: this doesn't fix other problems with no version of static
libresolv library, but this should be easy enough to get with
the bind code and linked in, and possibly be an even better resolv
then the one on the system to begin with.


 Doug Hughes                            Engineering Network Services
 doug () eng auburn edu                    Auburn University



Current thread: