<!doctype html>
<html>
 <head> 
  <meta charset="UTF-8"> 
 </head>
 <body>
  <div>
   <br>
  </div>
  <blockquote type="cite">
   <div>
    On 10/24/2020 8:31 AM Pauli Virtanen <<a href="mailto:pav@iki.fi">pav@iki.fi</a>> wrote:
   </div>
   <div>
    <br>
   </div>
   <div>
    <br>
   </div>
   <div>
    la, 2020-10-24 kello 03:11 -0400, Dustin Spicuzza kirjoitti:
   </div>
   <blockquote type="cite">
    <div>
     Cross-compiling scipy and other projects that depend on numpy's
    </div>
    <div>
     distutils is a huge pain right now, because to do it [in addition to
    </div>
    <div>
     lots of other details that you have to get right] you have to have
    </div>
    <div>
     both
    </div>
    <div>
     a native and cross-compiled version of numpy installed. It seems
    </div>
    <div>
     pretty
    </div>
    <div>
     unreasonable that I need a native version of numpy installed to
    </div>
    <div>
     compile
    </div>
    <div>
     scipy. One might ask, why is this needed?
    </div>
   </blockquote>
   <div>
    Factoring out numpy.distutils from numpy alone will not enable
   </div>
   <div>
    compiling scipy without numpy being installed. It probably can help,
   </div>
   <div>
    though, and might make sense also in view of the incoming deprecation
   </div>
   <div>
    of Python distutils (<a href="https://www.python.org/dev/peps/pep-0632/)" rel="noopener" target="_blank">https://www.python.org/dev/peps/pep-0632/)</a>.
   </div>
   <div>
    <br>
   </div>
   <div>
    Extension modules, including f2py, need numpy headers and probably also
   </div>
   <div>
    their platform-specific configuration. There are also some assumptions
   </div>
   <div>
    about data type sizes and Numpy versions at build-time being compatible
   </div>
   <div>
    with the ones at runtime, which factoring out distutils won't address.
   </div>
   <div>
    IIUC, cross-compilation is not actually supported, so that it can be
   </div>
   <div>
    made to work is surprising.
    <br>
   </div>
  </blockquote>
  <div>
   <br>
  </div>
  <div>
   Yes, as I said, there's a lot of little details that have to be correct for cross-compiling to work, but making numpy.distutils a separate toplevel will simplify other aspects of the process.
  </div>
  <div>
   <br>
  </div>
  <div>
   For those interested, the crossenv project (<a href="https://github.com/benfogle/crossenv">https://github.com/benfogle/crossenv</a>) takes care of a lot of those other details pretty well. I posted my steps for cross-compiling numpy/scipy utilizing crossenv at <a href="https://github.com/scipy/scipy/issues/8571#issuecomment-715877299">https://github.com/scipy/scipy/issues/8571#issuecomment-715877299</a>
  </div>
  <div>
   <br>
  </div>
  <div>
   Since this initial feedback seems mostly positive, I'll go ahead and take a stab at refactoring it and make a PR potentially this weekend. It should be fairly straightforward.
  </div>
  <div>
   <br>
  </div>
  <div>
   Dustin
  </div>
 </body>
</html>