[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] libmicrohttpd binary size?
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] libmicrohttpd binary size? |
Date: |
Thu, 23 Feb 2012 14:23:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Icedove/3.1.16 |
On 02/22/2012 07:13 PM, Glenn wrote:
I've been getting familiar with libmicrohttpd and the more more I understand
it, the more I like it. One thing I haven't been able to figure out, though, is
why the binaries I've been able to build are so large.
Executing './configure --disable-https --disable-messages
--disable-postprocessor --disable-dauth', then 'make' (CFLAGS=-Os
-fomit-frame-pointer in my environment) and finally 'sudo make install' results
in sizes of 152226 and 122697 for libmicrohttpd.a and libmicrohttpd.so.10.14.0,
respectively. (Linux Ubuntu 11.10, Intel i686 32 bit, gcc 4.5.4). --Not exactly
the 32k that is advertised.
Can someone provide a pointer to where this has already been discussed? If not,
then maybe someone can answer directly: Why are my libmicrohttpd binaries so
big?
Hmm. I just tried your command (please make sure CFLAGS is in your
environment *before* running configure; I suspect that might be part of
your problem) and on my system (gcc 4.6.2) I then get:
$ ls -al *.14.0
-rwxr-xr-x 1 grothoff grothoff 50897 Feb 23 14:08 libmicrohttpd.so.10.14.0
Now, you can further reduce the size by stripping the binary:
$ strip libmicrohttpd.so.10.14.0
After that, I get:
$ ls -al *.14.0
-rwxr-xr-x 1 grothoff grothoff 41296 Feb 23 14:08 libmicrohttpd.so.10.14.0
Now, this is on AMD64 -- and the instruction set plays some role in how
big the binary is. If you only care about size on disk, you could also
gzip it:
$ gzip *.14.0
$ ls -al *.gz
-rwxr-xr-x 1 grothoff grothoff 18922 Feb 23 14:08
libmicrohttpd.so.10.14.0.gz
Now, if I do the same on ARM, I get:
# ls -al
-rwxr-xr-x 1 root root 41093 2012-02-23 07:17 libmicrohttpd.so.10.14.0
# strip libmicrohttpd.so.10.14.0
# ls -al
libmicrohttpd.so.10.14.0
-rwxr-xr-x 1 root root 30724 2012-02-23 07:17 libmicrohttpd.so.10.14.0
This is where our "32k" claim comes from (as IMO ARM is what matters for
embedded devices, not Intel). Again, if you compress, you can get a bit
more:
# gzip *.14.0
-rwxr-xr-x 1 root root 16729 2012-02-23 07:17 libmicrohttpd.so.10.14.0.gz
Ultimately, on really small devices, none of these numbers are entirely
meaningful as you also need to consider which functions from libc/POSIX
you need for TCP/IP support, etc. Some revisions ago we eliminated use
of 'sscanf' in MHD to allow a more "minimal" version of libc to suffice
for MHD.
IIRC some members on this list run MHD on systems with as little as 128K
code space, so in such cases libc size does matter a lot. See also
https://gnunet.org/bugs/view.php?id=1688
Happy hacking!
Christian