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

Tim Hochberg tim.hochberg at cox.net
Fri Feb 10 09:41:12 CST 2006


Pearu Peterson wrote:

>
>
> On Thu, 9 Feb 2006, Tim Hochberg wrote:
>
>> Tim Hochberg wrote:
>>
>>> Pearu Peterson wrote:
>>>
>>>>
>>>>
>>>> On Thu, 9 Feb 2006, Tim Hochberg wrote:
>>>>
>>>>> I had this fantasy that default_lib_dirs would get picked up 
>>>>> automagically; however that does not happen. I still ended up 
>>>>> putting:
>>>>>
>>>>>           from  numpy.distutils import system_info
>>>>>           library_dirs = system_info.default_lib_dirs
>>>>>           result = 
>>>>> config_cmd.try_run(tc,include_dirs=[python_include], 
>>>>> library_dirs=library_dirs)
>>>>>
>>>>> into setup.py. Is that acceptable? It's not very elegant.
>>>>
>>>>
>>>>
>>>>
>>>> No, don't use system_info.default_lib_dirs.
>>>>
>>>> Use distutils.sysconfig.get_python_lib() to get the directory that 
>>>> contains Python library.
>>>
>>>
>>>
>>> That's the wrong library. Get_python_lib gives you the location of 
>>> the python standard library, not the location of python24.lib. The 
>>> former being python24/Lib (or python24/Lib/site-packages depending 
>>> what options you feed get_python_lib) 'and the latter being 
>>> python24/libs on my box.
>>
>
> Ok, but using system_info.default_lib_dirs is still wrong, this list 
> is not designed for this purpose..


OK.

>
>> To follow up on this a little bit, I investigated how distutils 
>> itself finds python24.lib. It turns out that it is in build_ext.py, 
>> near line 168. The relevant code is:
>>
>>       # also Python's library directory must be appended to library_dirs
>>       if os.name == 'nt':
>>           self.library_dirs.append(os.path.join(sys.exec_prefix, 
>> 'libs'))
>
>
> Hmm, this should be effective also for numpy.distutils. 
> self.library_dirs and other such attributes are used in 
> distutils.command.build_ext.run() method while our 
> numpy.distutils.command.build_ext.run() doesn't. So, I we have to do 
> is to update numpy.distutils.command.build_ext.run() method to resolve 
> this issue. This should fix also rpath issues that was reported on 
> this list for certain platforms. I'll look fixing it today..


While your looking at it, keep in mind that the original failure that I 
was trying to fix occurs when numpy/core/setup.py calls 
config_cmd.try_run.  I'm not certain, but I suspect that this isn't 
going to got through numpy.distutils.command.build_ext. One strategy 
would be to put a functions somewhere that returns these extra libray 
directories somewhere appropriate and call it from both 
numpy.distutils.command.build_ext and numpy/core/setup.py. It could look 
like:

def get_extra_library_dirs():
    if os.name == 'nt':
          return [os.path.join(sys.exec_prefix, 'libs')]
    else:
          return []

I'm not sure what would be an appropriate place for it though.

-tim

>
> Pearu
>
>






More information about the Numpy-discussion mailing list