www.hardcoder.com © 1999 - 2011 // all content by kathy ahn
LD_ASSUME_KERNEL
I was trying to update some ancient code from the old MySQL python module (the one written by Joseph Skinner that I can't even find a working link to anymore) to (an older version of) the newer MySQLdb module. My legacy scripts are running in python2.2 and I kept getting an ImportError: ... version GLIBC_2.0 not defined in libc.so.6 with link time reference.
LD_ASSUME_KERNEL is an environment variable that doesn't normally need to be set, but legacy apps can have dependencies on a specific set of libraries for glibc so you have to explicitly set the kernel version. Appropriate values for LD_ASSUME_KERNEL are valid linux kernel versions. In my case, using Python2.2 and MySQLdb-0.9.1 (which is a wrapper around _mysql), I had to set LD_ASSUME_KERNEL to 2.4.1.
Then, because my cgi-scripts are executed by apache, I had to use the SetEnv directive in my apache config as well: SetEnv LD_ASSUME_KERNEL 2.4.1.
Now, if I want to execute those scripts on the command line for testing, I also have to set the env variable, but I only did this temporarily for the xterm I was in or when I ran a script -- setting this in my .bashrc file caused other things to break so don't do that.
Set environmental variable for the term you're in:$ export LD_ASSUME_KERNEL=2.4.1
Change it just for this script run:$ env LD_ASSUME_KERNEL=2.4.1 ./my_python_script.py
Couple of docs about LD_ASSUME_KERNEL: