[Numpy-tickets] [NumPy] #993: [PATCH] Support for detecting libraries in several directories simultaneously

NumPy numpy-tickets@scipy....
Mon Feb 2 12:29:40 CST 2009

#993: [PATCH] Support for detecting libraries in several directories
 Reporter:  faltet           |       Owner:  cookedm
     Type:  defect           |      Status:  new    
 Priority:  normal           |   Milestone:  1.3.0  
Component:  numpy.distutils  |     Version:  none   
 Severity:  normal           |    Keywords:         
 I've found a problem with `numpy.distutils` when I want to specify
 multiple libraries for a !NumPy component that are spread in two or more
 directories.  For example, for linking against MKL, a `site.cfg` with the
 next contents:

 library_dirs =
 include_dirs =  /opt/intel/Compiler/11.0/074/mkl/include/
 mkl_libs = mkl_gf_lp64, mkl_gnu_thread, mkl_core, iomp5

 gives the next output:

   libraries mkl_gf_lp64,mkl_gnu_thread,mkl_core,iomp5 not found in
   libraries mkl_gf_lp64,mkl_gnu_thread,mkl_core,iomp5 not found in

 I've tracked down the problem in that `numpy.distutils` tries to find the
 complete set of libraries in one single directory, instead in the complete

 I'm attaching a fix that is able to find the set of required libraries in
 all the directories specified in `library_dirs` and only in one of them.
 With it, the output is:

     libraries = ['mkl_gf_lp64', 'mkl_gnu_thread', 'mkl_core', 'iomp5',
     library_dirs = ['/opt/intel/Compiler/11.0/074/mkl/lib/em64t/',
     define_macros = [('SCIPY_MKL_H', None)]
     include_dirs = ['/opt/intel/Compiler/11.0/074/mkl/include/']

 So, it seems to work well. Moreover, the fix simplifies quite a bit the
 logic in `system_info.py`.  However, caveat emptor: as I've only tested
 the MKL section, more testing should be carried out with other libraries
 than MKL before to apply the patch.

 Finally, attention should be payed to the next issue:

 In `atlas_info.calc_info()` method, I've not completely simplified the

         for d in lib_dirs:
             atlas = self.check_libs2(d,atlas_libs,[])
             lapack_atlas = self.check_libs2(d,['lapack_atlas'],[])
             if atlas is not None:
                 lib_dirs2 = [d] +
                 lapack = self.check_libs2(lib_dirs2,lapack_libs,[])
                 if lapack is not None:
             if atlas:
                 atlas_1 = atlas

 because I'm not sure about how can affect the use of
 `self.combine_paths()` in the previous loop, but I'd say that it could be
 rewritten as:

         atlas = self.check_libs2(lib_dirs,atlas_libs,[])
         lapack_atlas = self.check_libs2(lib_dirs,['lapack_atlas'],[])
         if atlas is not None:
             lib_dirs2 = [lib_dirs] +
             lapack = self.check_libs2(lib_dirs2,lapack_libs,[])
             atlas_1 = atlas


 So, if anybody with more knowledge than me can double check the patch, it
 would be great.


Ticket URL: <http://scipy.org/scipy/numpy/ticket/993>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list