0

Hi everyone,

Not really a problem as such but jsut wondering if anyone could explain this - when I build a product, the binary executable is roughly 50mb when done. When I tar it up and gzip it (tar -cvf name file; gzip -9 file) and unzip it the bianry is still 50mb. But when I create an rpm with it and install it, its only 12mb! The binary works fine with no problems, but is there some reason why it suddenly shrinks in size?

Any help is much appreciated,

Stephen

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by mike_2000_17
0

I think that rpm uses bzip2 to compress the image, which is significantly more efficient (usually - not always) than gzip, with respect to size at least. BTW, you can create a compressed tarball with just the tar command. For a gzipped one use tar -zcvf tarballname sources*, and for a bzip2 tarball use tar -jcvf tarballname sources*. You can leave off the 'v' option if you don't want the verbose output.

0

Yeah, it's just that once the rpm is installed, the binary file has went from 50mb to 12mb - does the compression apply to the file even once it has been installed?

0

That's odd I don't think I've ever had that problem unless the files were spread out in the system when the rpm was installed. Just a guess though.

What file was it?

0

Yeah, it's just that once the rpm is installed, the binary file has went from 50mb to 12mb - does the compression apply to the file even once it has been installed?

You have been shy with details, but I can think of two possible causes. First, maybe your original binary was a "debug" build. By default, when you compile programs on GCC, they will be laced with debugging symbols and hooks to facilitate debugging, and these can significantly increase the size of a binary. If you are using some packaging tool to create your rpm file, one which also handles the compilation, it will certainly strip away all unnecessary debug symbols and everything else, resulting in a much smaller and faster "release" version of the same program.

Second, have you ever heard of executable compression? Some distributions of Linux / Unix / Solaris / BSD-like operating systems come with executable compression (through upx or gzexe tools). It will either be turned on for all installed binaries (e.g., to occupy minimum HDD space), given as a configuration option for the OS, or maybe with some selection method (either the package manager decides to compress or not, or the rpm / deb file contains such instruction). It's hard to tell if that's your situation or not.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.