Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Samba: reduce bloat by linking dynamically #110

Closed
edolstra opened this Issue Aug 17, 2012 · 7 comments

Comments

Projects
None yet
7 participants
Owner

edolstra commented Aug 17, 2012 edited by vcunat

Samba is insanely bloated:

$ nix-build -A samba
/nix/store/i8qvmdq9b3q38ma8w0y04jzgf32xavd2-samba-3.6.7

$ du -sch ./result/
110M    ./result/

$ ls -l ./result/bin/
total 72872
-r-xr-xr-x 1 root nixbld 1862096 Dec 31  1969 eventlogadm
-r-xr-xr-x 1 root nixbld    4641 Dec 31  1969 findsmb
-r-xr-xr-x 1 root nixbld 8219864 Dec 31  1969 net
-r-xr-xr-x 1 root nixbld 1593640 Dec 31  1969 nmblookup
-r-xr-xr-x 1 root nixbld 3070992 Dec 31  1969 ntlm_auth
-r-xr-xr-x 1 root nixbld 2024040 Dec 31  1969 pdbedit
...

The main reason seems to be that the binaries in bin and sbin are statically linked against libsmbclient and libnetapi, even though we build dynamic versions of those.

The Samba source code says:

# WORKAROUND:
#   until we have organized other internal subsystems (as util, registry
#   and smbconf) into shared libraries, we CAN NOT link libnetapi
#   dynamically to samba programs.
#
LINK_LIBNETAPI=STATIC

LINK_LIBSMBCLIENT=STATIC

so it's not clear if dynamic linking is currently safe. However, https://bugs.archlinux.org/task/24678 suggests that using Samba's alternative "waf"-based build system does the right thing. So maybe we should investigate that.

edolstra pushed a commit to edolstra/nixpkgs that referenced this issue Oct 1, 2013

Merge pull request #110 from bjornfor/transmission-service
Add Transmission BitTorrent service
Member

shlevy commented Apr 4, 2014

@edolstra Have you had a chance to look into this yet? Do you plan to get it in before 14.04?

Member

vcunat commented Mar 14, 2015

@wkennington: any ideas about this issue? I see the size of samba is ~72MB currently, and we also have samba_light with ~113MB size (and less dependencies). I suspect that not supplying some dependencies forces samba to pack more stuff in, so it isn't really clear which is lighter (perhaps depending on other installed packages).

Contributor

wkennington commented Mar 14, 2015

Yeah, exactly. Light is just nicer in the sense that you have far fewer
dependencies.
On Mar 14, 2015 6:17 AM, "Vladimír Čunát" notifications@github.com wrote:

@wkennington https://github.com/wkennington: any ideas about this
issue? I see the size of samba is ~72MB currently, and we also have
samba_light with ~113MB size (and less dependencies). I suspect that not
supplying some dependencies forces samba to pack more stuff in, so it isn't
really clear which is lighter (perhaps depending on other installed
packages).


Reply to this email directly or view it on GitHub
#110 (comment).

Owner

domenkozar commented Apr 12, 2015

$  du -sch $(nix-store -qR $(nix-build -A samba_light))
...
162M    /nix/store/kml4z8cdrqjdbibzzil1wzzj5vl34r2l-samba-4.2.0
447M    total

$ du -sch $(nix-store -qR $(nix-build -A samba))
...
159M    /nix/store/wykzvg6bn0mip4dir7qzpfkm56a4ikgp-samba-4.2.0
841M    total

nckx added a commit that referenced this issue May 30, 2015

lz4 129 -> 130
Hotfix, solving issues with lz4cat.

- Fixed: incompatibility sparse mode vs console (#105)
- Fixed: LZ4IO exits too early when frame crc not present (#106)
- Fixed: incompatibility sparse mode vs append mode (#110)
- Performance fix: big compression speed boost for clang (+30%)
- New: cross-version test
Member

7c6f434c commented Feb 16, 2017

Samba is now 52MiB and the entire closure is 225MiB, of which 90MiB come from Python and Perl. Should this issue be closed?

Member

vcunat commented Feb 16, 2017

I do think so. Also ./result/bin/* sizes look sane now.

@vcunat vcunat closed this Feb 16, 2017

Member

vcunat commented Feb 16, 2017 edited

It might still be possible to improve. I suspect many reverse dependencies use mainly the libraries, so the ~13 MB in bin/ might be nice to split, for example (half of it is due to smbtorture, too :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment