Re: Updates to busybox
On Fri Oct 22, 1999 at 06:16:52PM +0200, Goswin Brederlow wrote:
> Erik Andersen <firstname.lastname@example.org> writes:
> > > > whiptail is 18k, plus an additional 65k for libnewt. I suspect that
> > > > this is something that will not shrink down very well, so I think that
> > > > keeping it outside of busybox may be best.
> You forgot libpopt. :)
Oops. You caught me -- I guess I didn't look very closly.
ldd `which whiptail` does show a big pile of stuff... Ugh.
> > That will probably be a win... Just staticly link libnewt into whiptail,
> > but make sure whiptail still uses the shared libc6.
> How exactly do I do that? If I do --static all will be static, won´t
> it? Do I have to link the .a file to it? I probably have to read the
> gcc docs for the first time, oh I hate info pages.
Yup. You don't want to use --static, since that will statically link in
_everything_, includeing libc which is best off being shared with other
To make stuff small, what you want to do when you link the production
version is do something like the following:
cc -Wall -Os -fomit-frame-pointer -c foo.c -o foo.o
cc <more stuff>
cc -s foo.o bar.o libnewt.a libpopt.a libfoo.a -o myapp
strip --remove-section=.note --remove-section=.comment myapp
This is totally undebuggable, but as small as possable. Check out the
busybox makefile for how to easily switch between debug and production
compilation. Anyway, the idea is to staticly link in _only_ the libs
that arn't shared with anything else in the system. This is nice, since
when you staticly link, the linker simple throws away any parts of
the library that you arn't using, so for example if libnewt has tons
of neat wide char support, but your app isn't using it, all the wchar
stuff would be thrown away at link time, leaving only what you use
(simplified, but basically true).
So the secret formula for staticly linking is to use it when only
exactly one app uses a particular library.
Erik B. Andersen Web: http://www.xmission.com/~andersen/
--This message was written using 73% post-consumer electrons--