cURL / Mailing Lists / curl-library / Single Mail


Re: Lib Size Usage in Embedded Systems

From: Dan Fandrich <>
Date: Tue, 6 Jul 2004 10:40:17 -0700

On Mon, Jul 05, 2004 at 10:20:46PM -0700, Sriram Venkat wrote:
> Hi,
> I tried inserting -s and removing -g in MakeFiles in the following
> directories
> ./. , src, include and lib directories.
> I was able to get a which is around 150 KB.

Using this configure line on an i686 box with gcc 2.96:

$ env CFLAGS=-Os ./configure --without-ssl --without-zlib --without-libidn --disable-debug --disable-ares --disable-ftp --disable-gopher --disable-file --disable-ldap --disable-dict --disable-telnet --disable-manual --disable-ipv6 --disable-thread

and stripping the file, I ended up with a 124 KiB shared library:

$ ll lib/.libs/
-rwxr-xr-x 1 dfandric nis 127768 Jul 6 09:47 lib/.libs/*
$ env LD_LIBRARY_PATH=lib/.libs curl --version
curl 7.12.0 (i386-redhat-linux-gnu) libcurl/7.12.0
Protocols: http
Features: Largefile

If you put a bit of effort into it, you could likely shave off a few tens of
KB from this figure. Since you only want http, the supplied getdate.y is
overkill and could be greatly dumbed down, saving 10 KB. By preventing the
linking of various unneeded stub files into the shared library, you could
save couple KB. If you don't need HTTP digest authentication, you could
add some #ifdefs in the code and add a --without-digest configure option
and safe another 8 KB. If you don't need verbose error strings, you could
add a --without-strerror and save another 6 KB.

This would bring you down below 100 KiB; much below that and you reach
the point of diminishing returns. This is still half your stated goal of
200 KB.

I was involved with an embedded project where we used the precursor to curl:
urlget. That added a mere 15 KB or so to our application size, and did http
as well as ftp. We spent so much effort hacking that code to add the
features we wanted that we ended up switching to curl for the next version,
where resources weren't quite so tight.

> Is there anyway to get a size reduced than this.
> Do u have any tiny version of libcurl lib for embedded systems ?.
> Do u know any other tiny version of http Lib which is very stable.
> I want to use libcurl for HTTP ONLY.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2004-07-06