[Numpy-discussion] toward python 2.6: mtrand, gettimeofday and mingw

David Cournapeau david at ar.media.kyoto-u.ac.jp
Fri Nov 14 02:14:57 EST 2008


Hi,

    Since I think it would be nice for numpy 1.3 to support python 2.6,
I took a further look at it on windows. AFAICS, there is only one
problem remaining, when building with mingw. The error is exactly as in
the following bug report:

http://bugs.python.org/issue3308

I am not sure I understand exactly the problem in numpy case: the
failure appears in mtrand, because of the function gettimeofday. I can't
find gettimeofday on MSDN (google only returns link to a win32
replacement for gettimeofday), so I don't understand why it works fine
when compiling with VS 2008.

Since the problem is specific to python 2.6, which depends on the MS C
runtime 9.0 (the one with Visual Studio 2008), I *guess* that mingw has
an implementation of gettimeofday internally which depend on those time
functions, and since its MS runtime 9.0 wrapper for it (libmsvcr90.a)
wrongly defines some time-related functions which are not exported by
the MS runtime, it fails.

Anyway, one solution would be to implement our own gettimeofday from MS
specific functions (such code is available on the internet, and is only
a few lines), or use directly MS specific functions. My understanding is
that since this is used for the random seed, the exact time returned by
the function does not matter much, but it would mean that the seed would
be different from what it used to be, and some people complained
recently about similar issues. Of course, the right fix is for mingw to
fix its def files for msvc runtimes, but given that last mingw release
was a long time ago, I don't think we would be able to build numpy 1.3
with it without workaround.

David



More information about the NumPy-Discussion mailing list