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? -- Craig McQueen
On Wed, Nov 14, 2018 at 9:25 PM Craig McQueen via samba <samba at lists.samba.org> 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? > > -- > Craig McQueenI'm not a member of that team. But is there some compelling reason you can't simply install "cifs-utils"?
On Thu, Nov 15, 2018 at 02:24:08AM +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?Can you just do a "normal" build and then separate out the shared libraries needed that smbclient links to (via ldd bin/smbclient) ? Hockey and not an automated solution, but should get you the minimal set you need for smbclient..
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. 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
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: --nonshared-binary=smbclient 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
Nico Kadel-Garcia wrote:> On Wed, Nov 14, 2018 at 9:25 PM Craig McQueen via samba > <samba at lists.samba.org> 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? > > > > I'm not a member of that team. But is there some compelling reason you > can't simply install "cifs-utils"?I did look into that, and had some success. However, I found that sometimes unmount is slow (30-60s), and sometimes after apparently unmounting, the CIFS mount persisted being listed in the mount table. So I'd need to figure out what was happening there, before being able to use that reliably. -- Craig McQueen