On Thu, Jun 30, 2022 at 10:57 AM Ralf Gommers <ralf.gomm...@gmail.com> wrote:
> > > On Thu, Jun 30, 2022 at 10:47 AM Matthew Brett <matthew.br...@gmail.com> > wrote: > >> Hi, >> >> On Thu, Jun 30, 2022 at 9:40 AM Ralf Gommers <ralf.gomm...@gmail.com> >> wrote: >> > >> > >> > >> > On Thu, Jun 30, 2022 at 10:29 AM Matthew Brett <matthew.br...@gmail.com> >> wrote: >> >> >> >> Hi, >> >> >> >> On Thu, Jun 30, 2022 at 12:42 AM Kevin Sheppard >> >> <kevin.k.shepp...@gmail.com> wrote: >> >> >> >> >> >> >> >> >> Hi, >> >> >> >> >> >> I am very sorry - I feel I should know this, or be able to work it >> >> >> out, but is there a way of setting the flags to the C compiler and >> the >> >> >> linker, for the Numpy build, on Windows? >> >> >> >> >> >> I'm trying to set the flags for a build with Windows mingw-w64 - >> but I >> >> >> believe Numpy is ignoring $env:LDFLAGS, $env:CFLAGS and $env:OPT - >> and >> >> >> I can't see any way of setting these options from the command line. >> >> >> Am I missing something? >> >> >> >> >> >> Cheers, >> >> >> >> >> >> Matthew >> >> >> >> >> Member address: kevin.k.shepp...@gmail.com >> >> > >> >> > >> >> > I think these are all hard coded and non-changable. This was the >> case when I got NumPy building with clang-cl. >> >> >> >> That was my impression too, but I was delayed by the text at: >> >> >> >> >> https://numpy.org/doc/stable/user/building.html#supplying-additional-compiler-flags >> >> >> >> which says: >> >> >> >> """ >> >> Additional compiler flags can be supplied by setting the OPT, FOPT >> >> (for Fortran), and CC environment variables. When providing options >> >> that should improve the performance of the code ensure that you also >> >> set -DNDEBUG so that debugging code is not executed. >> >> """ >> >> >> >> I guess we should change that text to note these do not work on >> Windows. >> >> >> >> I think you can supply extra Fortran flags with the `config_gc` option >> >> to `setup.py`, but I don't think the others have any effect on >> >> Windows. >> >> >> >> I was also confused by these lines in `azure-steps-windows.yml`: >> >> >> >> """ >> >> $env:CFLAGS = "-m32" >> >> $env:LDFLAGS = "-m32" >> >> """ >> >> >> >> I assume these don't actually have any effect. >> > >> > >> > No, the above all seem wrong (unless there has been a major regression >> recently), and the `-m32` flags work and are necessary. CFLAGS, FFLAGS, >> CXXFLAGS and LDFLAGS can be used, and append compile flags. If you want to >> remove flags that are already hardcoded in numpy.distutils, then that's a >> different story - you need to edit the numpy.distutils source code then. >> > >> > I just stumbled on a Windows problem with `$env:`, and the problem was >> Windows CI is hopelessly weird. It matters for example if you do something >> in a Powershell context (`ps |` in a .yml file) or outside of it. So it may >> be something like that. >> >> Are you sure though - that you can append flags to the compile and >> link step with CFLAGS and LDFLAGS? It didn't work for me locally. >> And I can't see where they would have an effect, on Windows, in the >> code. >> > > Yes I'm sure, and it's even one of the few things in numpy.distutils that > are tested: https://github.com/numpy/numpy/pull/14250. Maybe see if you > can make that test fail when setting env vars in a couple of different ways? > Note that the C/C++ handling can come from plain `distutils`, but it should work the same. Here's a PR that fixes the Windows wheel builds for SciPy for a Pythran issue by using CXXFLAGS: https://github.com/MacPython/scipy-wheels/pull/122. The CPython bug tracker is full of noise about this kind of env var handling, nothing conclusive as far as I know. It's of course possible that it's broken under some circumstances (or in `setuptools.distutils`). There are no tests for this in CPython it looks like. Cheers, Ralf
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com