[Samba] how to reduce binary size of SAMBA 4 for embeded device

Andrew Bartlett abartlet at samba.org
Fri Nov 15 02:20:53 UTC 2019

On Sun, 2017-08-06 at 17:03 +1200, Andrew Bartlett via samba wrote:
> On Wed, 2017-08-02 at 17:37 +0800, 袁建鹏 wrote:
> > Hi, Bartlett
> > 
> > I decided to cut some subsystem by myself,
> > So I spent several days to study the SAMBA 4 WAF build system and
> > now know the base steps of build.
> > but which subsystem can be removed for snmd/nmbd/smbpasswd ?
> That is, essentially, your task.  You could compile it under
> callcatcher, or use some other symbol dependency tracker to work out
> what libraries are linked but not used.
> The real problem however is when a binary like smbd links against a
> library, a, which uses b.  However often the way that smbd uses a
> does
> not require b, but it remains a useless dependency.  
> The classic example of this is also the easiest one to start solving,
> which is that smbd links against libndr-standard and libndr-samba-
> samba4.  However, most of those libs are not used: sometimes the only
> link in is via the ndr_table which lists all our generated IDL by

I had a go at this recently, and re-posted the results here:


Changing "-O2" to "-Os -s" I got Samba to a 9152kb smbd.  Still much
more than I know you are hoping for, and I had to cut some important
functionality to make this proof of concept compile, but it shows what
is possible.

Andrew Bartlett
Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba mailing list