Question

I have download the bash shell version 4.2 form here: http://ftp.gnu.org/gnu/bash/, and then compiled it by my self using the following command:

./configure
make

But the bash I compiled is much bigger then one system provided:

This is my bash:

$ ls -lh bash
-rwxrwxr-x 1 unimous unimous 3.8M Oct 31 23:57 bash

This is the system's bash:

$ ls -hl /bin/bash 
-rwxr-xr-x 1 root root 937K Sep 19 21:40 /bin/bash
Was it helpful?

Solution

Assuming you have downloaded the source for bash that directly matches the version of your system, there are several things that could be different:

  • Bash has a lot of build configuration options because it's one of the most portable pieces of software in existence. The default ./configure will select options that most people would want that will work on the system you're using to build it.

  • The production install targets for bash do not strip the installed executable. Most people that download the source for bash and build it themselves are probably doing so because they want different behavior than their OS provides, or a different version altogether. In either case, people would want debug symbols left until stability has been established.

  • 'Special sauce' added by the distribution

To directly reproduce the build, you'd need to get the source to the package your distro provided, and use the build tools (or, just grab the build config options out of them and apply them to the version you downloaded), then strip the resulting executable.

Keep in mind, distros are absolutely free to apply their own patches (or 'sauce') to the things they package. You have to check for this as well, and be sure to apply the same patches to bash that your distro did.

In short, it's easier to just grab the source package from your distro if all you want to do is reproduce the build, unless you want to use the official release version that GNU provides.

OTHER TIPS

The sizes would match more closely if you ran strip(1). As Tim Post points out, the production make targets for bash do not strip, as they assume users want debugging symbols. However distribution targets do strip.

It's impossible to know exactly why without knowing how both you and the package maintainer compiled bash.

It's possible you statically linked certain libraries that are dynamically linked in the system provided package. Perhaps they compiled with fewer features enabled. Maybe they used different compile flags, if you have some debug symbols included, but the package has been fully stripped, that would also account for some difference. Different optimization levels would also have an effect on size.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top