LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

FAQS
 FAQs
Apache FAQ
Linux FAQ
XML FAQ

Log in to particpate






   Linux FAQ > 6. Porting, Compiling and Obtaining Programs
Question:  6.12. Programs Are Very Large.
Answer:

With an ELF compiler ("What's All This about ELF? glibc?"), the most common cause of large executables is the lack of an appropriate .so library link for one of the libraries you're using. There should be a link like libc.so for every library like libc.so.5.2.18.

With an a.out compiler the most common cause of large executables is the -g linker (compiler) flag. This produces (as well as debugging information in the output file) a program which is statically linked—one which includes a copy of the C library instead of a dynamically linked copy.

Other things worth investigating are -O and -O2, which enable optimization (check the GCC documentation), and -s (or the strip command) which strip the symbol information from the resulting binary (making debugging totally impossible).

You may wish to use -N on very small executables (less than 8K with the -N), but you shouldn't do this unless you understand its performance implications, and definitely never with daemons.


This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by: