[Distutils] libraries options

Rene Liebscher R.Liebscher@gmx.de
Tue Feb 6 07:46:40 2001


"M.-A. Lemburg" wrote:
> 
> Robin Becker wrote:
> >
> > In article <3A7EF75F.BE1B5E56@lemburg.com>, M.-A. Lemburg
> > <mal@lemburg.com> writes
> > >Robin Becker wrote:
> > .....
> > >> OK I have been using static libs with distutils for a couple of days and
> > >> have noticed the following.
> > >>
> > >> 1) Under win32 at least the .lib files are placed by default in
> > >> temp.win32-2.0\ imho they should be placed alongside other object
> > >> modules.
> > >>
> > >> 2) The lib objects aren't placed in a release/debug subdirectory.
> > >>
> > >> 3) If a dynamic lib of the same name is present in one of the
> > >> directories mentioned in a libpath option that lib gets used first
> > >> (wrongly).
> > >
> > >Hmm, the source says:
> > >
> > >            # The MSVC linker generates .lib and .exp files, which cannot be
> > >            # suppressed by any linker switches. The .lib files may even be
> > >            # needed! Make sure they are generated in the temporary build
> > >            # directory. Since they have different names for debug and release
> > >            # builds, they can go into the same directory.
> > >
> > and for _ext builds they do indeed make these in the appropriate place
> >
> > eg building bingo.pyd
> >
> > build/temp.win32-2.0/Release
> >
> > contains bingo.obj, bingo.exp and bingo.lib and the .pyd ends up in
> >
> > build/lib.win32-2.0
> >
> > however building static dingo.lib for use by bingo
> >
> > dingo.obj ends up in
> >
> > build/temp.win32-2.0/dingo and dingo.lib ends up in
> > build/temp.win32-2.0/
> >
> > Certainly if I build two .pyds each using different subroutines sub.c
> > they're going to clash in Release.
> >
> > >Don't the debug builds have the "_d" suffix ? This should avoid
> > >any problems with mixing the two.
> >
> > that may be true, but since we have only one .obj directory don't the
> > objects clash?
> 
> I guess so.
> 
> Would it be hard to move all objects and libs into
> the Release/Debug dirs, rather than keeping them in the top-level
> build directory ?

The difference between dynamic and static libraries is, that in
build_ext
the build_temp variable gets "Release" or "Debug" appended where
build_clib
doesn't change build_temp.

If you would copy these (about 5) lines (from build_ext
finalize_options)
into build_clib.py your problems should disappear. 
(Maybe you have also to change the build_clib variable.)
 
> I am not sure about the consequences of making this change,
> but since we're in control here (distutils is building the
> command line, so we can fiddle with it in any way we want to),
> we can easily leverage any problems this might cause by adding
> some explicit paths.
> 
> Could you submit a patch for this ?
> 

>...

Kind regards
Rene Liebscher