install problem: xlib link error

I've been trying to install matplotlib with interactive plotting
support on a non-standard linux distribution ( I
have successfully installed matplotlib 0.90.1 with python 2.4.3 and
IPython 0.7.2. I can make plots with any of the image backends, but
the TkAgg backend fails with an "undefined symbol" error.

To install with TkAgg support I edited as follows:


I run the build and install steps as root, getting no errors. If I
set the backend to Agg I can produce pdf or png plots just fine.
However, when I try to import the TkAgg backend, I get the following

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/", line 1, in ?
   from matplotlib.pylab import *
File "/usr/lib/python2.4/site-packages/matplotlib/", line 222, in ?
   new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/lib/python2.4/site-packages/matplotlib/backends/",
line 24, in pylab_setup
File "/usr/lib/python2.4/site-packages/matplotlib/backends/",
line 8, in ?
   import tkagg # Paint image to Tk photo blitter extension
File "/usr/lib/python2.4/site-packages/matplotlib/backends/",
line 1, in ?
   import _tkagg
ImportError: /usr/lib/python2.4/site-packages/matplotlib/backends/
undefined symbol: XSetInputFocus

(I get the same error when testing as root or with my own user account)

This looks to me like a linker error. Maybe the xlib library is not
properly linked? I've checked that xsetinputfocus appears in
/usr/X11R7/include/X11/Xlib.h and I have added this directory to as:

basedir = {
   'win32' : ['win32_static',],
   'linux2' : ['/usr/local', '/usr','/usr/X11R7/include/X11',],
   'linux' : ['/usr/local', '/usr','/usr/X11R7/include/X11',],

Is there some other file I should be locating and linking, or some
other way to include xlib?