More tea please.

Additional dynpk glibc wrangling

Warning: Mangling may occur.

I was in the process of setting up to record a screencast of how to use dynpk, when I discovered that my dynpk fu no longer ran on the RHEL machine I was using. Running my program resulted in this friendly output:

FATAL: kernel too old

Turns out this is a message brought to us by glibc. glibc has a configure option ‘–enable-kernel’. The argument to this option is a Linux version, e.g. 2.6.18. This tells glibc the minimum Linux version that the resulting built stuff has to support. Apparently telling it the name of a more recent kernel version can improve performance because it doesn’t have to include as much compatibility cruft.

The current Fedora 14 glibc is built with this argument set to 2.6.32. Running a statically linked binary generated on F14 on a RHEL 5 machine running 2.6.18 is thus no longer possible without some additional work. What additional work is that? Rebuilding the C library with the ‘–enable-kernel’ option set to something compatible with the target system. glibc will still present the same API to the programs we want to run, but includes the additional fudge for old kernel version compatibility. We don’t have to rebuild all of our programs, just shoehorn our own glibc into the bundle dynpk makes.

“Rebuild the C library from source, you’re crazy.” I hear you say whilst backing away slowly. It’s not a massive deal. All I have to do is:

% fedpkg co -a glibc
% cd glibc
... change 2.6.32 to 2.6.18 in glibc.spec ...
% fedpkg local
... crunch, bang, whizz, pop ...

And some time later, out spring some RPMs. You’ll find the ones I’m using for F14 on RHEL5 here (don’t install them!).

I’ve modified dynpk so that it can take uninstalled RPM files and install them into the bundle (it’s a rather naive install, but it does the job right now). It can also take some glibc RPMs to build its own wrapper against. Here’s how: The build process is modified slightly:

% make GLIBC_RPMS="glibc-2.12.90-18.i386.rpm glibc-static-2.12.90-18.i386.rpm"
... nom nom nom ...

One would then add this to the dynpk configuration:

local_rpms: glibc-2.12.90-18.i386.rpm glibc-common-2.12.90-18.i386.rpm

And BANG, the stuff that comes out of dynpk now runs on RHEL5 again.

(Photo copyright flickr user paperbits under CC by-nc-nd.)

Posted at 8:56 pm on Tuesday 9th November 2010

Comments are closed.

Site by Rob Gilton. © 2008 - 2019