Bug 479210

Summary: static linking does not guarantee to work across RHEL major release
Product: Red Hat Enterprise Linux 5 Reporter: Chris Lo <mychrislo>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 5.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-08 00:26:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chris Lo 2009-01-08 00:20:51 UTC
Description of problem:
default glibc installation .SPEC has little downward kernel compatibility.
Even static link is not portable.

glibc.spec
Conflicts: kernel < 2.6.9
%define enablekernel 2.6.9

Version-Release number of selected component (if applicable):
source compile platform RHEL 5.2
target compile running platform RHEL 3

How reproducible:
# vi hello.cpp

#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}

# g++ hello.cpp -m32 -static -o hello
  
# file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, statically linked, for GNU/Linux 2.6.9, not stripped

# ./hello
Hello World!

Actual results:
On the target RHEL 3 platform using same static binary.
# ./hello
FATAL: kernel too old
Segmentation fault

Recompile glibc in RHEL 5.2 to have enablekernel 2.4.0 and Conflicts < 2.4.0 and recompile static also cannot run the program in lower version of RHEL.

Expected results:
static binary portability.

Additional info:

Comment 1 Jakub Jelinek 2009-01-08 00:26:35 UTC
Statically linked programs are (unlike dynamically linked programs) never portable across major releases.  See http://people.redhat.com/drepper/no_static_linking.html