[Numpy-discussion] Distutils: using different linker options for c++ and c code

Robert Kern robert.kern@gmail....
Thu Apr 17 15:02:33 CDT 2008


On Thu, Apr 17, 2008 at 6:34 AM, David Cournapeau
<david@ar.media.kyoto-u.ac.jp> wrote:
> Hi,
>
>     I cannot seem to make scipy.sparse works on windows with mingw32,
>  and it seems related to the msvc runtime. I always get segfaults in the
>  sparsetools module (c++); if I build the module manually to control the
>  options precisely and remove the -lmsvc71 from the build command, I
>  cannot reproduce the segfault anymore (but the segfault does not happen
>  100 % of the time, so it is hard to be sure)
>
>     So is there a way in distutils to make the difference between C++
>  and C: for extension with C, use the msvc, for extensions in C++, do not
>  use it ? (The obvious hack consisting in remove msvc alltogether does
>  not work: it crahses in scipy.io, which is linked to incompatible FILE
>  structures between mingw and VS, I guess).

Ah, this problem again. The build of mingw that you are using were
written with msvcrt in mind. For the most part they are compatible
with msvcr71, but there are a few places where they reference a table
that is different between the two runtimes, namely iostream in C++ and
ischar() in C. Consequently, there are some extension modules built
with mingw which work with msvcrt because they need iostream, some
with msvcr71 because they need to pass FILE pointers, and probably
some which won't work with either. The core problem won't be fixed
until mingw writes their headers for msvcr71. They may have; it looks
like they just released some new builds this month. It would be worth
checking these out.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the Numpy-discussion mailing list