[Numpy-discussion] Is there a known problem compiling numpy with VC7? Success

Tim Hochberg tim.hochberg at cox.net
Thu Feb 9 08:30:10 EST 2006


Travis Oliphant wrote:

> Tim Hochberg wrote:
>
>> I'm attaching the two modified setup files. The first is 
>> numpy/core/setup.py and the second is numpy/random/setup.py.  I tried 
>> to keep the modifications as minimal as possible. With these two 
>> setup files, and adding M_PI to numpy\random\mtrand\distributions.c, 
>> numpy compiles fine and passes all tests except for the 
>> test_minrelpath path I mentioned in my last message.
>
>
>
> I'm trying to incorporate your changes.


Great.

> 1) M_PI was easy to fix.
>
> 2) In the core/setup.py file you sent you add the line:
>
>   python_libs = join(distutils.sysconfig.EXEC_PREFIX, 'libs')
>
> I'm not sure what this is supposed to do.  What problem does it fix on 
> your system?  It makes no sence on mine as this becomes
>
> python_libs = '/usr/libs'
>
> which is not a directory.

OK, we'll have to work out something that works for both. The issue here 
on windows is that compiling the testcode requires python.lib, and it 
doesn't get found unless that directory is specified. The problem is 
perhaps related to the following comment in system_info.py

if sys.platform == 'win32': # line 116
    default_lib_dirs = ['C:\\'] # probably not very helpful...

In any event, it does seem like there should be a better way to find 
where python.lib lives, but I couldn't find it in my perusal of the 
distutils docs.

>
> 3) For the setup.py file in random you are using Advapi for all win32 
> platforms.  But, this seems to be a windows NT file

I'm compiling on XP FWIW.

> or at least only needed when compiling with certain compilers.  
> Mingw32 built just fine without it.   So, I'm not sure how to handle 
> this.

My guess, and it's only a gues because I use neither mingw or the 
windows crypto stuff, is that defines are set differently by mingw so 
that the parts that need that library are not being compiled when you 
use mingw. The code in question is all gaurded by:

#ifdef _WIN32
#ifndef RK_NO_WINCRYPT

As far as I can tell, RK_NO_WINCRYPT never gets defined anywhere, so the 
important test is for _WIN32. So, does mingw define _WIN32? If it does 
not, then that's what's going on. In that case, the proper test is 
probably to check if _WIN32 is defined by the compiler in question and 
include Advapi only then. If it does define _WIN32, then I dunno!

-tim







More information about the NumPy-Discussion mailing list