When a piece of software is being developed, it is useful for the programmer to include debugging information into the resulting executable. This way, if there are problems encountered when running the executable, the programmer can load the executable into a debugging software package and track down any software bugs.
This is useful for the programmer, but unnecessary for the user. We can assume that the package, once finished and available for download has already been tested and debugged. However, when we compiled the software above, debugging information was still compiled into the final executable. Since it is unlikey that we are going to need this debugging information, we can strip it out of the final executable. One of the advantages of this is a much smaller executable, which should run slightly faster.
What we are going to do is look at the before and after size of the binary file. First change into the bin directory of the units installation directory.
% cd ~/units174/bin
% ls -l
As you can see, the file is over 100 kbytes in size. You can get more information on the type of file by using the file command.
% file units
units: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), not stripped
To strip all the debug and line numbering information out of the binary file, use the strip command
% strip units
% ls -l
As you can see, the file is now 36 kbytes - a third of its original size. Two thirds of the binary file was debug code!!!
Check the file information again.
% file units
units: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), stripped
Sometimes you can use the make command to install pre-stripped copies of all the binary files when you install the package. Instead of typing make install, simply type make install-strip
0 Comments