too big binaries

Piotr Rotter rot at active24.pl
Sat Dec 14 22:51:07 UTC 2013


W dniu 14.12.2013 21:27, Harald Becker pisze:
> Hi Piotr !
>
>> I compiled it in ubuntu and then libs has that size
>>
>> 1,1M libm-2.17.so
>> 1,8M libc-2.17.so
>> 146K ld-2.17.so
>
> add this up and sum size of your distro Busybox binary and you
> get about 3 MB.
>
>> I thought that linker take only parts from libs whose are needed.
>
> You mix static and dynamic linking. Static linking needs the .a
> libraries and include only required routines. As Busybox does
> many different things it links in many functions of the C
> libraries and you get a big binary with bad scaled libraries like
> GNU glibc. On the other side even a 2 MB binary is less the size
> you need to run the dynamically linked version. To run that
> binary you need to install the .so libraries, which take around 3
> MB (plus possible more required stuff).
>
> If you want to get smaller statically linked binaries you may
> have a look on different C libraries, like uClibc or musl (but
> not exclusive, there may exist other working libraries). Those
> libraries try to scale better on statically linked binaries.
>
>> What can I do, what distro can I use to reduce static compiled
>> busybox si ze?
>
> It is not directly distro specific. Most well known distros
> use glibc and dynamic linking. To install the full set of
> programs required by the distros, you need a library whith every
> whistle and bell and compatible C++ libraries. If you want to
> create small statically linked binaries you need a library
> optimized for that purpose, which usually fail on installation of
> many higher level packages (like GUI programs).
>
> May be you get better success using Arch Linux or other distros
> optimized for embedded devices, but other distros like Ubuntu or
> Gentoo also allow to install parallel extra libraries and allow
> to create statically build binaries (but this my not be
> considered a trivial job).
>
> Dig into documents for tool chains, cross compiling/linking and
> differences on linking statical/dynamical. This is not only
> Busybox related, and no failure of the build process.
>
> Sometimes it is easier to ask for a statically linked version for
> your platform, than building it for your own. Or take a
> statically linked version from a fitting distro.
>
> --
> Harald
>

Hello,

Thank you for answer. I do not except that binaries on webside are 
compiled with uclibc (not glibc) and I don't except that it's make that 
huge different. So I'll try compile uclibc and next I'll try compile 
busybox with uclibc not glibc. I hope that some tricks in makefile enough.



More information about the busybox mailing list