[Samba] Lightweight build of smbclient only

Craig McQueen craig.mcqueen at innerrange.com
Tue Nov 20 01:15:04 UTC 2018

Andrew Bartlett wrote:
> On Thu, 2018-11-15 at 02:24 +0000, Craig McQueen via samba wrote:
> > I'm interested in using smbclient in an embedded Linux system, to copy
> files to a Windows file share. I don't need the entire samba suite. I'd like to
> get a smbclient compile that is reasonably small (less than 3 MB ideally).
> >
> > I'm building the embedded Linux system cross-compiled for an ARM based
> platform using Yocto. Yocto has support for building samba. But it is aimed at
> the complete samba suite, whereas I really only want smbclient. In the past
> I've been able to cut it down reasonably to just the smbclient. But in the last
> year, changes to samba and the Yocto samba package have made it more
> difficult to cut it down to a minimal smbclient.
> >
> > What would the samba team recommend for cross-compiling a small
> smbclient suitable for embedded Linux?
> It probably still won't be small, but you can try:
> (untested)
> ./configure --nonshared=binary=smbclient
> This would give you a single static binary.
> I did try and to work to have a Samba build that then used global optimization
> and linker flags to remove unused code, but those patches never went
> anywhere.  They were posted to samba-technical under a thread title of
> 'making samba small again' a couple of years ago.

I tried:
but it didn't seem to make any difference. The resulting smbclient was still dynamically linked.

I found a previous post which led me to try adding:
--bundled-libraries=talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent --with-static-modules=ALL

But that also didn't seem to make any difference.

I can verify by inspecting config.log that the options are being passed in. But I'm not sure why they're having no effect. Here is the complete options listed in config.log:

# using ./buildtools/bin/waf configure --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --without-acl-support --without-ad-dc --without-libarchive --without-cluster-support --disable-cups --without-dmapi --without-fam --enable-gnutls --disable-iprint --with-ldap --without-lttng --with-system-mitkrb5 --with-system-mitkdc=/usr/sbin/krb5kdc --without-systemd --without-valgrind --without-winbind --enable-avahi --enable-fhs --with-piddir=/run --with-sockets-dir=/run/samba --with-modulesdir=/usr/lib/samba --with-lockdir=/var/lib/samba --with-cachedir=/var/lib/samba --disable-rpath-install --bundled-libraries=heimdal,cmocka,NONE --disable-glusterfs --with-cluster-support --with-profiling-data --with-libiconv=/home/craigm/yocto-sumo/poky/build/tmp/work/armv7ahf-neon-poky-linux-gnueabi/samba/4.7.6-r0/recipe-sysroot/usr --with-pammodulesdir=/lib/security --without-pam --nonshared-binary=smbclient --bundled-libraries=talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent --with-static-modules=ALL --cross-compile --cross-answers=/home/craigm/yocto-sumo/poky/build/tmp/work/armv7ahf-neon-poky-linux-gnueabi/samba/4.7.6-r0/samba-4.7.6/cross-answers-arm.txt

Craig McQueen

More information about the samba mailing list