[Distutils] Problems on NT
Thomas Heller
thomas.heller@ion-tof.com
Wed, 29 Mar 2000 11:12:02 +0200
> > 2. The python/libs directory is no longer
> > included in library_dirs when linking extensions.
>
> Hmmm. Was it ever? And why is this necessary? Is it so extensions can
> link against Python.dll, or is it something else?
>
> Anyone out there been following the recent CVS tumult and trying to
> build stuff on Windows?
>
> Thomas (or anyone else on a Windows box with access to the anonymous CVS
> tree), if you're feeling hardy, you could try rolling back the
> command/build_ext.py file one revision at a time until either 1) the
> problem goes away or 2) things blow up horribly because of other
> incompatibilities. If #2 occurs, try rolling back all of Distutils a
> week at a time, or maybe 2-3 days at a time. Let me know if you want
> help with the CVS trickery to do this.
The problem occurred after cvs revision 1.24 of build_ext.py.
Don't know about unix, but on Windows extensions must be linked against
python15.lib (or python15_d.lib if building debug versions).
The names of the libraries do not need to be supplied on the command line,
they are built with compiler pragmas into the object-files.
However they must be found, so the directory must be included in the
library search path.
msvccompiler.__init__ (on line 162) does this:
self.add_library_dir( os.path.join( sys.exec_prefix, 'libs' ) )
(If I understood distutils design philosophy correctly, this probably
belongs into build_ext, because it is python extension specific, on
the other hand, it may be NT specific).
This dir is later *overwritten* in ccompiler.set_library_dirs(),
which is called from build_ext, line 185:
if self.library_dirs is not None:
self.compiler.set_library_dirs (self.library_dirs)
Some lines above (line 146) I find the following code:
# Simplify the following logic (eg. don't have to worry about
# appending to None)
if self.libraries is None:
self.libraries = []
if self.library_dirs is None:
self.library_dirs = []
if self.rpath is None:
self.rpath = []
So, if I change the code around line 185 to:
if self.library_dirs:
self.compiler.set_library_dirs (self.library_dirs)
then it works because no library_dirs are specified in the setup_script
or from the command line, but IMO the bug is still there.
I'll leave it up to you to find the correct fix for this.
BTW: Another small bug in build_ext.py:
self.build_extensions()
should be
self.build_extensions (self.extensions)
Thomas