[Python-Dev] configure and setup.py

Sjoerd Mullender sjoerd at acm.org
Tue Sep 2 15:31:17 EDT 2003

I am trying to build Python on a Unix system (Irix in this case, but
that's irrelevant) and I am getting a bit frustrated.

The problem is this.  I tell configure where to find libraries and
include files using options such as CPPFLAGS='-I...' and LDFLAGS='-L...'
(you can provide those on the configure command line).

Making Python then goes relatively smoothly.  However, building the
dynamically loadable modules with setup.py does *not* work smoothly.
The main problem is that setup.py does not use all relevant information
from the Makefile.  I just submitted a bug report (with patch) for
distutils so that it'll use the LDFLAGS variable from the Makefile, but
that's not enough.

Setup.py checks whether it can find certain libraries (readline comes to
mind, that's the one that triggered my investigation).  There are a
number of extra system-dependent directories hard-coded in setup.py, but
it totally ignores the directories that were specified at configure
time.  I think this is not the right way of doing things.

If any knowledge about where compilers look for libraries should be
built in anywhere, it's in distutils, not setup.py.  Also, and more
importantly, distutils should figure out the extra library directories
that were specified at configure time and add the information to the
list of searchable directories (CCompiler.library_dirs).  If this were
done, setup.py would find my -lreadline and the readline module would
get compiled and I would be able to edit in my interactive Python.

The same goes for include files.

-- Sjoerd Mullender <sjoerd at acm.org>

More information about the Python-Dev mailing list