Red Hat Bugzilla – Bug 227584
gcc produces binaries that cannot be run on previous Fedora or on RHEL
Last modified: 2007-11-30 17:11:56 EST
Description of problem:
gcc produces binaries that cannot be run on previous Fedora, or on RHEL.
This can easily be fixed by changing --hash=gnu to --hash=both in the specfile.
Version-Release number of selected component (if applicable):
Compile a binary on FC6. Try running it on FC5 or RHEL.
Steps to Reproduce:
Generally, you can't run binaries/libraries on older releases either, due to
glibc/libstdc++/libgcc etc. symbol versioning or older SONAMEs of libraries
on the older distributions.
So, if you want to create binaries/libraries usable on older distributions,
you need to have that in mind and either build them in a chroot containing
the oldest distribution you want to support, or using e.g. a compatibility
gcc and glibc. compat-gcc-34 in FC6 e.g. defaults to -Wl,--hash-style=sysv
and therefore what it generates is, as long as it is linked against compatibility
glibc and other compatibility libraries (and compiled against compatibility
headers) should be usable on (some) older releases.
-Wl,--hash-style=gnu is intentional, it makes the allocated part of
binaries/libraries quite a bit smaller and requiring less memory at runtime.
Forgot to say, this is mentioned in FC6 release notes.