executable footprint reduction

Ken Cross kjchome at comcast.net
Wed Feb 4 03:52:51 GMT 2004

First of all: no, no, no -- the LIBS line is only the tip of the iceberg.
All the other changes you indicated are also necessary (except maybe the
references to bin/libsmbclient.so).

Secondly, the order is very important.  In fact, depending on the OS, it may
be necessary to actually install libsmbclient before the others can be
linked (this can be done with "make installclientlib").

Thirdly, the -R and -L are examples of what I meant by being
system-specific.  The -L is used for link-time libraries; the -R is used for
run-time libraries (at least on NetBSD).

Finally, all of this illustrates why it probably hasn't been done -- it's
non-trivial to do in a system-independent manner.

Having said all that, I still think it's worth it.  Apparently you do, too.


-----Original Message-----
From: samba-technical-bounces+kcross=nssolutions.com at lists.samba.org
[mailto:samba-technical-bounces+kcross=nssolutions.com at lists.samba.org] On
Behalf Of David Wuertele
Sent: Tuesday, February 03, 2004 9:13 PM
To: samba-technical at lists.samba.org
Subject: Re: executable footprint reduction

Ken> FWIW, I've been doing in for about a year, but linking to dynamic
Ken> libraries is somewhat system-dependent (I'm on NetBSD).  For
Ken> instance, I've added this at the top of Makefile.in:

Ken>  LIBS=@LIBS@ -L bin -R $(DESTDIR)${prefix}/lib -lsmbclient

OK, I went ahead and tried this.  I'm not sure what the -R is for... I
replaced it with -L because that's what it looks like you are using it

Things don't build in the right order with just this change, because
the executable targets don't depend on building
bin/libsmbclient.so... I'm not sure how you got around that, but what
I did was make everything that uses $(LIBS) depend explicitly on
bin/libsmbclient.so.  Then I had to replace the $(LIBS) on the
libsmbclient.so target action to get rid of the recursive reference.

Once all that was done and it all built, I compared sizes between the
stock build, your build, and my build:

  # wc -c */source/bin/smbclient
  1193648 samba-3.0.0-stock-Makefile/source/bin/smbclient
  1193624 samba-3.0.0-kencross-Makefile/source/bin/smbclient
   199814 samba-3.0.0-dave-Makefile/source/bin/smbclient

So it looks to me like your patch (or at least my mangling of your
patch) is insufficient with gcc-3.3.1, glibc-2.3.2, and linux.

If somebody knows a better way to patch the Makefile.in than the way I
posted earlier, please let me know.


More information about the samba-technical mailing list