[comp.soft-sys.andrew] Statically linking "runapp"

tom@sparc01.icase.edu (Tom Crockett) (02/22/90)

Excerpts from info-andrew: 13-Feb-90 Statically linking "runapp".. Guy
Harris@uunet.uu.net (679)

> >I finally got Andrew Release 3 up and running -- seems the Imakefiles
> >neglected to put in some "-Bstatic" options in the right places in the
> >Makefiles.  The places I know about are atk/apps (for runapp) and
> >atk/ness/objects (for nessrun).  Are there any others I may have
> >missed?

> Err, umm, why do you want to build "runapp" statically?  I modified the
> Imakefile too, but I did it to link with "-lX11" rather than
> "/usr/lib/libX11.a", so that it would pick up the *shared* "libX11";
> heck, even if I run *no* non-Andrew X11 applications other than the
> window manager, I still get some sharing, and there will be other
> non-Andrew X11 applications that I'd run, I suspect....


Well, I've been running some further experiments with my static vs.
dynamic linking problem on SPARCstations.  It turns out that the only
library I have to link in statically to runapp is -lm.  With -lm
dynamically linked, many of my Andrew apps core dump before ever
displaying a window.  With it statically linked, everything seems to run
just fine.  Beats the heck out of me -- maybe I have a damaged version
of the shared math library.

I also looked at the relative sizes of some things when using dynamic
vs. static linking.  For my test case, I had the following X clients
active, which is reasonably representative of my usual working
environment:

    twm
    xterm (2)
    xman
    xload (2) running on remote machines
    console
    bush
    ez (2)
    messages

For purposes of comparison, everything was iconified except console and
the two xterms.

I made the modification Guy suggested, substituting -lX11 for
/usr/lib/libX11.a in the Makefile.  I then built two versions of runapp,
one using -Bstatic for all of the libraries, and one using it only for
the troublesome -lm.  Much to my surprise, the completely static version
used about 900K less swap space, as reported by "pstat -T".  messages
itself was well over 600K smaller (SZ field from "ps aux") in the static
version.

Does anybody have a good explanation for this?  I rebuilt runapp a
couple of times each way, just to be sure I hadn't made any mistakes
about which version was which.

-Tom