1 Tips to obtain a very small static elinks binary
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 Tips to obtain a very small static elinks binary suitable for mini
7 Remove config.cache (previous CC may be cached):
11 Use dietlibc (http://www.fefe.de/dietlibc/) or similar stuff (uClibc, ...):
13 $ export CC='diet -Os gcc'
15 Use compilers flags to optimize for size:
17 $ export CFLAGS='-s -fno-inline -nostdinc -fomit-frame-pointer'
19 Note that if you don't use dietlibc, you definitively want to add `-Os` or
20 `-O2` to `CFLAGS`; GCC 2.95 does not know `-Os`, and some say `-O2` gives
21 smaller executables even for GCC 3.x.
25 ===============================================================================
26 If you use these `CFLAGS` on Cygwin and you get unresolved symbols (`htons` and
27 suite in particular), try removing `-fno-inline` parameter.
28 ===============================================================================
30 Disable some compile-time options:
32 ------------------------------------------------------------------------------
33 $ ./configure --disable-ipv6 --disable-backtrace --disable-nls \
34 --enable-fastmem --without-zlib --without-bzlib --disable-xbel \
35 --without-lua --without-gnutls --without-openssl --without-x \
36 --enable-small --without-spidermonkey --without-gpm
37 ------------------------------------------------------------------------------
39 You can disable bookmarks, globhist and more, too, if you want to.
43 ===============================================================================
44 - --disable-backtrace disables internal backtrace code.
45 - --disable-nls disables i18n support.
46 - --enable-fastmem disables internal `malloc()` debugging and use `alloca()`
48 - --enable-small forces to remove some text descriptions in options and
49 keybind stuff (regain 30Kb).
50 ===============================================================================
52 Dependencies over external libs must be removed using the related configure
54 `-----------------------`------------------------------------------------------
56 -------------------------------------------------------------------------------
57 --without-zlib removes libz dependency (compression)
58 --without-bzlib removes libbz2 dependency (compression)
59 --disable-xbel removes expat dependency (XBEL bookmarks support)
60 --without-lua removes liblua dependency (Lua scripting)
61 --without-gnutls removes libtls dependency (SSL support)
62 --without-openssl removes libssl dependency (SSL support)
63 --without-x removes libx11 dependency (restoring terminal title)
64 --without-spidermonkey removes libjs dependency (JavaScript)
65 --without-gpm removes libgpm dependency (mouse/console)
66 -------------------------------------------------------------------------------
68 It seems GCC 2.95.x do not generate as small binaries as GCC 3.2.x with same
71 You can use an executable compressor like UPX
72 link:http://upx.sourceforge.net/[].
74 Here are some results using gcc 2.95.3, dietlibc-0.23, and previous flags:
77 -rwxr-xr-x 1 zas users 495100 Oct 20 15:53 src/elinks
78 me$ upx --best src/elinks
80 -rwxr-xr-x 1 zas users 217946 Oct 20 15:53 src/elinks
82 Whow ! Around 200kb :)
85 .Details about the `--enable-small` configure option effects:
86 ==============================================================================
87 - it disables long descriptions of options;
88 - it disables textual descriptions of keybinding options;
89 - it reduces size of some HTTP errors messages;
90 - it disables fastfind feature, reducing performance, but also reducing a lot
91 memory usage, and a bit the executable size.
92 ==============================================================================