[Distutils] Bug report: debug builds on msvc compiler don't specify *_d.lib as link sources

Thomas Heller thomas.heller@ion-tof.com
Thu Sep 28 13:00:01 2000


> In ccompiler, you have this code in gen_lib_options:
>
>     for lib in libraries:
>         (lib_dir, lib_name) = os.path.split (lib)
>         if lib_dir:
>             lib_file = compiler.find_library_file ([lib_dir], lib_name)
>             if lib_file:
>                 lib_opts.append (lib_file)
>             else:
>                 compiler.warn ("no library file corresponding to "
>                                "'%s' found (skipping)" % lib)
>         else:
>             lib_opts.append (compiler.library_option (lib))
>
> Note that you aren't passing "debug" to compiler.find_library_file, so the
> debug libraries will never get used.  Also note that msvccompiler doesn't
> provide for passing the debug flag to library_option, so it doesn't do the
> proper name mangling (adding _d) for the library name.  I'm guessing
you'll
> need to make gen_lib_options get passed the debug flag, and then make it
> pass that flag on to the compiler methods.  No clue what to do for
non-vc++
> compilers (or even if they need debug flags).

You are completely right: MSVCCompiler links with the wrong library
on debug builds.

I just tried and noticed that python15.lib is explicitely passed
to the linker (for both debug and release builds) although this
is completely unneccessary for MSVC, since the python import library
is already set with in pragma in Python.h.

Maybe you should try one of the older code snapshots (for
a certain definition of 'old')...

Thomas