Making Samba small again: static smbd: 19MB to 13MB?

Andrew Bartlett abartlet at samba.org
Mon Jan 30 10:51:57 UTC 2017


Thinking about the 'without python' use case and the cries from folks
for a smaller smbd, I tried some gcc options.

(original)
du -m bin/default/source3/smbd/smbd
19	bin/default/source3/smbd/smbd

(new)
du -m bin/default/source3/smbd/smbd
13	bin/default/source3/smbd/smbd

The options I set were:

CFLAGS="-O2 -flto -fwhole-program " LDFLAGS="-O2 -flto -fwhole-program "

The rest of the command remains the same:

 ./configure --bundled-libraries=talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent --with-static-modules=ALL --nonshared-binary=smbtorture,smbd/smbd --with-system-mitkrb5 --without-ad-dc && make -j

Now, the build fails, but not before spitting out the smaller smbd.


I don't claim it even works (I just tried smbd -b and smbd -V), but I
figured those who are passionate about this stuff won't be too far
behind.  A tweak to waf to only specify "-flto -fwhole-program" when
building and linking the non-shared binaries would help a lot. 

The next step would be a bare fileserver build without spoolss,
netlogon and any other pipes we don't strictly need, as the PIDL
generated code from the extra idl is probably a fair chunk of what we
removed and what we still could eliminate.

To make this build, I needed the attached patch (please review/push) to
not initialise vfs_posix_eadb without the AD DC.

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-build-vfs_posix_eadb-is-only-built-with-the-AD-DC-en.patch
Type: text/x-patch
Size: 1632 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170130/85a1d9cd/0001-build-vfs_posix_eadb-is-only-built-with-the-AD-DC-en.bin>


More information about the samba-technical mailing list