Repository: spack/spack

Issue:
Installation issue: py-pythran with %apple-clang@13:
### Steps to reproduce the issue

```console
$ spack spec -I py-scipy
Input spec
--------------------------------
 -   py-scipy

Concretized
--------------------------------
 -   py-scipy@1.8.1%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]      ^openblas@0.3.20%apple-clang@13.1.6~bignuma~consistent_fpcsr~ilp64+locking+pic+shared symbol_suffix=none threads=none arch=darwin-monterey-m1
[+]          ^perl@5.34.1%apple-clang@13.1.6+cpanm+shared+threads arch=darwin-monterey-m1
[+]              ^berkeley-db@18.1.40%apple-clang@13.1.6+cxx~docs+stl patches=b231fcc arch=darwin-monterey-m1
[+]                  ^gnuconfig@2021-08-14%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]              ^bzip2@1.0.8%apple-clang@13.1.6~debug~pic+shared arch=darwin-monterey-m1
[+]                  ^diffutils@3.8%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]                      ^libiconv@1.16%apple-clang@13.1.6 libs=shared,static arch=darwin-monterey-m1
[+]              ^gdbm@1.19%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]                  ^readline@8.1%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]                      ^ncurses@6.2%apple-clang@13.1.6~symlinks+termlib abi=none arch=darwin-monterey-m1
[+]                          ^pkgconf@1.8.0%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]              ^zlib@1.2.12%apple-clang@13.1.6+optimize+pic+shared patches=0d38234 arch=darwin-monterey-m1
[+]      ^py-cython@0.29.24%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]          ^py-pip@21.3.1%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]              ^python@3.9.12%apple-clang@13.1.6+bz2+ctypes+dbm~debug+ensurepip+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93,4c24573,f2fd060 arch=darwin-monterey-m1
[+]                  ^apple-libuuid@1353.100.2%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]                  ^expat@2.4.8%apple-clang@13.1.6~libbsd arch=darwin-monterey-m1
[+]                  ^gettext@0.21%apple-clang@13.1.6+bzip2+curses+git~libunistring+libxml2+tar+xz arch=darwin-monterey-m1
[+]                      ^libxml2@2.9.13%apple-clang@13.1.6~python arch=darwin-monterey-m1
[+]                          ^xz@5.2.5%apple-clang@13.1.6~pic libs=shared,static arch=darwin-monterey-m1
[+]                      ^tar@1.34%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]                  ^libffi@3.4.2%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]                  ^openssl@1.1.1o%apple-clang@13.1.6~docs~shared certs=system arch=darwin-monterey-m1
[+]                  ^sqlite@3.38.5%apple-clang@13.1.6+column_metadata+dynamic_extensions+fts~functions+rtree arch=darwin-monterey-m1
[+]          ^py-setuptools@59.4.0%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]              ^py-wheel@0.37.0%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]      ^py-numpy@1.22.3%apple-clang@13.1.6+blas+lapack patches=873745d,e9508c3 arch=darwin-monterey-m1
[+]      ^py-pybind11@2.6.2%apple-clang@13.1.6~ipo build_type=RelWithDebInfo arch=darwin-monterey-m1
[+]          ^cmake@3.23.1%apple-clang@13.1.6~doc+ncurses+ownlibs~qt build_type=Release arch=darwin-monterey-m1
[+]          ^ninja@1.10.2%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]      ^py-pythran@0.10.0%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]          ^llvm-openmp@12.0.1%apple-clang@13.1.6~ipo~multicompat build_type=RelWithDebInfo arch=darwin-monterey-m1
[+]          ^py-beniget@0.4.1%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]              ^py-gast@0.5.3%apple-clang@13.1.6 arch=darwin-monterey-m1
[+]          ^py-ply@3.11%apple-clang@13.1.6 arch=darwin-monterey-m1
```


### Error message

<details><summary>Error message</summary>

```
==> Installing py-scipy-1.8.1-g7nte77nzfufu6ugosoxaccvraljpj7s
==> No binary for py-scipy-1.8.1-g7nte77nzfufu6ugosoxaccvraljpj7s found: installing from source
==> Fetching https://files.pythonhosted.org/packages/source/s/scipy/scipy-1.8.1.tar.gz
==> No patches needed for py-scipy
==> py-scipy: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    '/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/python-3.9.12-pnsfrnzawd6qnwmnxel2sq3auz4phmvx/bin/python3.9' '-m' 'pip' '-vvv' '--no-input' '--no-cache-dir' '--disable-pip-version-check' 'install' '--no-deps' '--ignore-installed' '--no-build-isolation' '--no-warn-script-location' '--no-index' '--prefix=/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-scipy-1.8.1-g7nte77nzfufu6ugosoxaccvraljpj7s' '.'

27 errors found in build log:
     11       Created temporary directory: /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-install-crub8qed
     12       Processing /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/ajstewart/spack-stage/spack-stage-py-scipy-1.8.1-g7nte77nzfufu6ugosoxaccvraljpj7s/spack-src
     13         Added file:///private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/ajstewart/spack-stage/spack-stage-py-scipy-1.8.1-g7nte77nzfufu6ugosoxaccvraljpj7s/spack-src to build
               tracker '/private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-req-tracker-5b5sv5v_'
     14         Created temporary directory: /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja
     15         Preparing metadata (pyproject.toml): started
     16         Running command /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/python-3.9.12-pnsfrnzawd6qnwmnxel2sq3auz4phmvx/bin/python3.9 /Users/ajstewart/spack
              /opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pip-21.3.1-rbmkfazzetpjqsxmt7zirbejhozlwzht/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py pre
              pare_metadata_for_build_wheel /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpudmybs12
  >> 17       setup.py:486: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja'), p
              roceeding with generating Cython sources and expanding templates
     18           warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
     19         Running from SciPy source directory.
     20         Running scipy/linalg/_generate_pyx.py
     21         Running scipy/special/_generate_pyx.py
     22         Running scipy/stats/_generate_pyx.py
     23         Processing scipy/cluster/_vq.pyx

     ...

     80         Processing scipy/stats/_sobol.pyx
     81         Processing scipy/stats/_boost/src/beta_ufunc.pyx
     82         Processing scipy/stats/_boost/src/nbinom_ufunc.pyx
     83         Processing scipy/stats/_boost/src/hypergeom_ufunc.pyx
     84         Processing scipy/stats/_boost/src/binom_ufunc.pyx
     85         Processing scipy/stats/_unuran/unuran_wrapper.pyx
  >> 86       warning: unuran_wrapper.pyx:470:21: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line
              .
  >> 87         warning: unuran_wrapper.pyx:470:28: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own li
              ne.
  >> 88         warning: unuran_wrapper.pyx:470:36: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own li
              ne.
  >> 89         warning: unuran_wrapper.pyx:515:21: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own li
              ne.
  >> 90         warning: unuran_wrapper.pyx:515:28: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own li
              ne.
  >> 91         warning: unuran_wrapper.pyx:515:36: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own li
              ne.
  >> 92         warning: unuran_wrapper.pyx:1469:21: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own l
              ine.
  >> 93         warning: unuran_wrapper.pyx:1469:28: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own l
              ine.
  >> 94         warning: unuran_wrapper.pyx:1469:36: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own l
              ine.
     95         Cythonizing sources
     96         INFO: lapack_opt_info:
     97         INFO: lapack_armpl_info:
     98         INFO: customize UnixCCompiler
     99         INFO:   libraries armpl_lp64_mp not found in ['/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/python-3.9.12-pnsfrnzawd6qnwmnxel2sq3auz4phmvx/lib',
               '/usr/local/lib', '/usr/lib']
     100        INFO:   NOT AVAILABLE

     ...

     1220       copying /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/src
              /fortranobject.h -> build/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9/scipy/linalg
     1221       INFO:   adding 'build/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9/scipy/linalg/_fblas-f2pywrappers.f' to sources.
     1222       INFO: building extension "scipy.linalg._flapack" sources
     1223       INFO: from_template:> build/src.macosx-12-arm64-3.9/scipy/linalg/flapack.pyf
     1224       INFO: f2py options: []
     1225       INFO: f2py: build/src.macosx-12-arm64-3.9/scipy/linalg/flapack.pyf
  >> 1226     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py:1
              508: ExprWarning: fromstring: treating "'A'||" as symbol (original=(compute_v?(2*(*range=='A'||(*range=='I' && iu-il+1==n)?n:0)):0))
     1227         ewarn(
  >> 1228       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py
              :1508: ExprWarning: fromstring: treating "'I' && iu" as symbol (original=(compute_v?(2*(*range=='A'||(*range=='I' && iu-il+1==n)?n:0)):0))
     1229         ewarn(
  >> 1230       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py
              :1508: ExprWarning: fromstring: treating '(jobt == 0)&&' as symbol (original=((jobt == 0)&&(jobu == 3)?0:m))
     1231         ewarn(
  >> 1232       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py
              :1508: ExprWarning: fromstring: treating '(jobt == 0)&&' as symbol (original=((jobt == 0)&&(jobu == 3)?0:(jobu == 1?m:n)))
     1233         ewarn(
  >> 1234       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py
              :1508: ExprWarning: fromstring: treating '(jobt == 0)&&' as symbol (original=((jobt == 0)&&(jobv == 3)?0:ldv))
     1235         ewarn(
  >> 1236       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py
              :1508: ExprWarning: fromstring: treating '(jobt == 0)&&' as symbol (original=((jobt == 0)&&(jobv == 3)?0:n))
     1237         ewarn(
     1238       append_needs: unknown need 'float'
     1239       append_needs: unknown need 'float'
     1240       append_needs: unknown need 'double'
     1241       append_needs: unknown need 'double'
     1242       append_needs: unknown need 'float'

     ...

     3891       INFO: building extension "scipy.spatial._voronoi" sources
     3892       INFO: building extension "scipy.spatial._hausdorff" sources
     3893       INFO: building extension "scipy.special._specfun" sources
     3894       creating build/src.macosx-12-arm64-3.9/scipy/special
     3895       INFO: f2py options: ['--no-wrap-functions']
     3896       INFO: f2py: scipy/special/specfun.pyf
  >> 3897     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py:1
              508: ExprWarning: fromstring: treating '(int)v' as symbol (original=(int)v+1)
     3898         ewarn(
  >> 3899       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/f2py/symbolic.py
              :1508: ExprWarning: fromstring: treating '(int)v' as symbol (original=abs((int)v)+2)
     3900         ewarn(
     3901       Reading fortran codes...
     3902       	Reading file 'scipy/special/specfun.pyf' (format:free)
     3903       Post-processing...
     3904       	Block: _specfun
     3905       			Block: clqmn

     ...

     4065       creating build/src.macosx-12-arm64-3.9/scipy/_lib
     4066       INFO: building extension "scipy._lib._test_deprecation_call" sources
     4067       INFO: building extension "scipy._lib._test_deprecation_def" sources
     4068       INFO: building extension "scipy._lib._uarray._uarray" sources
     4069       INFO: building data_files sources
     4070       INFO: build_src: building npy-pkg config files
  >> 4071     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-setuptools-59.4.0-pm3mcml26z4rxcayqgrbluqs5basrb3b/lib/python3.9/site-packages/setuptools/command/
              install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
     4072         warnings.warn(
     4073       creating /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info
     4074       writing /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info/PKG-INFO
     4075       writing dependency_links to /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info/dependency_links.txt
     4076       writing requirements to /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info/requires.txt
     4077       writing top-level names to /private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info/top_level.txt
     4078       writing manifest file '/private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info/SOURCES.txt'
  >> 4079     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-setuptools-59.4.0-pm3mcml26z4rxcayqgrbluqs5basrb3b/lib/python3.9/site-packages/setuptools/command/
              egg_info.py:624: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
     4080       Please extend command classes from setuptools instead of distutils.
     4081         warnings.warn(
     4082       reading manifest file '/private/var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/pip-modern-metadata-pj24xaja/scipy.egg-info/SOURCES.txt'
     4083       reading manifest template 'MANIFEST.in'
     4084       warning: no previously-included files matching '*_subr_*.f' found under directory 'scipy/linalg/src/id_dist/src'
     4085       no previously-included directories found matching 'benchmarks/env'

     ...

     5065       creating /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5u
              xcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy
     5066       creating /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5u
              xcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils
     5067       creating /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5u
              xcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks
     5068       INFO: compile options: '-c'
     5069       extra options: '-march=native'
     5070       WARN: CCompilerOpt.dist_test[598] : CCompilerOpt._dist_test_spawn[732] : Command (/Users/ajstewart/spack/lib/spack/env/clang/clang -Wno-unused-result -Wsign-compare -Wunr
              eachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -ftrapping-math -c /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxc
              omk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/test_flags.c -o /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt/s
              pack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/test_flags.o -MMD -MF /var/fo
              lders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6
              /lib/python3.9/site-packages/numpy/distutils/checks/test_flags.o.d -march=native) failed with exit status 1 output ->
  >> 5071     clang: error: the clang compiler does not support '-march=native'
     5072     
     5073       WARN: CCompilerOpt.cc_test_flags[1033] : testing failed
     5074       INFO: CCompilerOpt.cc_test_flags[1029] : testing flags (-O3)
     5075       INFO: C compiler: /Users/ajstewart/spack/lib/spack/env/clang/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -ftrapping-mat
              h
     5076     
     5077       INFO: compile options: '-c'

     ...

     5142       INFO: C compiler: /Users/ajstewart/spack/lib/spack/env/clang/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -ftrapping-mat
              h
     5143     
     5144       INFO: compile options: '-c'
     5145       extra options: '-march=armv8.2-a+fp16+fp16fml -Werror=switch'
     5146       WARN: CCompilerOpt.dist_test[598] : CCompilerOpt._dist_test_spawn[732] : Command (/Users/ajstewart/spack/lib/spack/env/clang/clang -Wno-unused-result -Wsign-compare -Wunr
              eachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -ftrapping-math -c /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxc
              omk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/cpu_asimdfhm.c -o /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt
              /spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/cpu_asimdfhm.o -MMD -MF /va
              r/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/tmpobc4t8cz/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv4
              7du6/lib/python3.9/site-packages/numpy/distutils/checks/cpu_asimdfhm.o.d -march=armv8.2-a+fp16+fp16fml -Werror=switch) failed with exit status 1 output ->
     5147       warning: overriding currently unsupported use of floating point exceptions on this target [-Wunsupported-floating-point-opt]
  >> 5148     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/c
              pu_asimdfhm.c:13:35: error: implicit declaration of function 'vfmlal_low_u32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
     5149           int ret  = (int)vget_lane_f32(vfmlal_low_u32(vlf, vlhp, vlhp), 0);
     5150                                         ^
     5151       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks
              /cpu_asimdfhm.c:13:35: note: did you mean 'vfmlal_low_f16'?
     5152       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/arm_neon.h:43691:18: note: 'vfmlal_low_f16' declared here
     5153       __ai float32x2_t vfmlal_low_f16(float32x2_t __p0, float16x4_t __p1, float16x4_t __p2) {
     5154                        ^
  >> 5155     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/c
              pu_asimdfhm.c:13:21: error: initializing 'float32x2_t' (vector of 2 'float32_t' values) with an expression of incompatible type 'int'
     5156           int ret  = (int)vget_lane_f32(vfmlal_low_u32(vlf, vlhp, vlhp), 0);
     5157                           ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     5158       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/arm_neon.h:7977:15: note: expanded from macro 'vget_lane_f32'
     5159         float32x2_t __s0 = __p0; \
     5160                     ^      ~~~~
  >> 5161       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks
              /cpu_asimdfhm.c:14:36: error: implicit declaration of function 'vfmlslq_high_u32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
     5162               ret += (int)vgetq_lane_f32(vfmlslq_high_u32(vf, vhp, vhp), 0);
     5163                                          ^
     5164       /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks
              /cpu_asimdfhm.c:14:36: note: did you mean 'vmlsl_high_u32'?
     5165       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/arm_neon.h:69448:17: note: 'vmlsl_high_u32' declared here
     5166       __ai uint64x2_t vmlsl_high_u32(uint64x2_t __p0, uint32x4_t __p1, uint32x4_t __p2) {
     5167                       ^
  >> 5168     /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/c
              pu_asimdfhm.c:14:21: error: initializing 'float32x4_t' (vector of 4 'float32_t' values) with an expression of incompatible type 'int'
     5169               ret += (int)vgetq_lane_f32(vfmlslq_high_u32(vf, vhp, vhp), 0);
     5170                           ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     5171       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/arm_neon.h:7787:15: note: expanded from macro 'vgetq_lane_f32'
     5172         float32x4_t __s0 = __p0; \
     5173                     ^      ~~~~
     5174       1 warning and 4 errors generated.

     ...

     15566      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/NoneType.hpp:8:
     15567      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/builtins/bool_.hpp:7:
     15568      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/tuple.hpp:13:
     15569      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/ndarray.hpp:10:
     15570      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/builtins/ValueError.hpp:6:
     15571      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/exceptions.hpp:6:
  >> 15572    /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-packages/pythran/pythonic/types
              /str.hpp:407:12: error: no matching constructor for initialization of 'typename str::reverse_iterator' (aka 'reverse_iterator<(anonymous namespace)::pythonic::types::string
              _iterator>')
     15573          return {data->rbegin()};
     15574                 ^~~~~~~~~~~~~~~~
     15575      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:37:28: note: candidate con
              structor (the implicit copy constructor) not viable: no known conversion from 'reverse_iterator<std::basic_string<char>::iterator>' to 'const reverse_iterator<(anonymous na
              mespace)::pythonic::types::string_iterator>' for 1st argument
     15576      class _LIBCPP_TEMPLATE_VIS reverse_iterator
     15577                                 ^
     15578      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:37:28: note: candidate con
              structor (the implicit move constructor) not viable: no known conversion from 'reverse_iterator<std::basic_string<char>::iterator>' to 'reverse_iterator<(anonymous namespac
              e)::pythonic::types::string_iterator>' for 1st argument

     ...

     15591      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/NoneType.hpp:8:
     15592      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/builtins/bool_.hpp:7:
     15593      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/tuple.hpp:13:
     15594      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/ndarray.hpp:10:
     15595      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/builtins/ValueError.hpp:6:
     15596      In file included from /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-package
              s/pythran/pythonic/types/exceptions.hpp:6:
  >> 15597    /Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-pythran-0.10.0-5s7ddwhqdhs23ascfw76qyjff3hsp7t7/lib/python3.9/site-packages/pythran/pythonic/types
              /str.hpp:417:12: error: no matching constructor for initialization of 'typename str::reverse_iterator' (aka 'reverse_iterator<(anonymous namespace)::pythonic::types::string
              _iterator>')
     15598          return {data->rend()};
     15599                 ^~~~~~~~~~~~~~
     15600      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:37:28: note: candidate con
              structor (the implicit copy constructor) not viable: no known conversion from 'reverse_iterator<std::basic_string<char>::iterator>' to 'const reverse_iterator<(anonymous na
              mespace)::pythonic::types::string_iterator>' for 1st argument
     15601      class _LIBCPP_TEMPLATE_VIS reverse_iterator
     15602                                 ^
     15603      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:37:28: note: candidate con
              structor (the implicit move constructor) not viable: no known conversion from 'reverse_iterator<std::basic_string<char>::iterator>' to 'reverse_iterator<(anonymous namespac
              e)::pythonic::types::string_iterator>' for 1st argument

See build log for details:
  /var/folders/j1/68dlgpr91vlgs26vty2c8xk80000gn/T/ajstewart/spack-stage/spack-stage-py-scipy-1.8.1-g7nte77nzfufu6ugosoxaccvraljpj7s/spack-build-out.txt
```
</details>


### Information on your system

* **Spack:** 0.18.0.dev0 (29f3f735c4ddaadd682be8fb0f17026c6ff75f31)
* **Python:** 3.8.9
* **Platform:** darwin-monterey-m1
* **Concretizer:** clingo

### Additional information

* [spack-build-out.txt](https://github.com/spack/spack/files/8721077/spack-build-out.txt)
* [spack-build-env.txt](https://github.com/spack/spack/files/8721079/spack-build-env.txt)

@rgommers any special magic to get scipy to build on Apple M1 (arm64)? Or is this an issue with Apple Clang 13.1.6/GFortran 11.2.0?

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
> clang: error: the clang compiler does not support '-march=native'

Some context: https://stackoverflow.com/questions/65966969/why-does-march-native-not-work-on-apple-m1
Hmm, this is a little strange, because the `-march=native` has been in `numpy.distutils` for 2 years: https://github.com/numpy/numpy/blame/65a701fd40d5ab3b772131daf45679d6ecf3d721/numpy/distutils/ccompiler_opt.py#L207

I can build SciPy just fine with Clang 11 from conda-forge on macOS M1. 
What about:
```
/Users/ajstewart/spack/opt/spack/darwin-monterey-m1/apple-clang-13.1.6/py-numpy-1.22.3-n3vuwsniihxa5uxcomk5hpq7lsv47du6/lib/python3.9/site-packages/numpy/distutils/checks/cpu_asimdfhm.c:13:35: error: implicit declaration of function 'vfmlal_low_u32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           int ret  = (int)vget_lane_f32(vfmlal_low_u32(vlf, vlhp, vlhp), 0);
                                         ^
```
Is that related to the `-march=native` issue or something different?

Could be an issue with Clang 13 or with M1 Pro, not just M1 in general.
Just rebuilding now: in the build log with scipy `main` and numpy `1.22.2` I see `-march=armv8.3-a` instead of `-march=native` (conda-forge dev env, Clang 11.1). Rebuilding with Apple Clang (13.1.6) now and numpy 1.22.3 to be sure - but it all seems happy.
Ah, it looks like the build log is incomplete - I believe both the `-march=native` and the `vfmlal_low_u32` are from the build stage where `numpy.distutils` is doing compiler feature testing. Those should not be fatal errors, but just result in turning off the options under test. This is a frequent source of confusion unfortunately.

The actual problem seems to be:
```
error: no matching constructor for initialization of 'typename str::reverse_iterator' (aka 'reverse_iterator<(anonymous namespace)::pythonic::types::string
              _iterator>')
```
Which I also haven't seen before, but I'll have a browse in the SciPy and Pythran trackers.
And I can reproduce that error with Apple Clang on my system.
It should be fixed by https://github.com/serge-sans-paille/pythran/issues/1937, and indeed upgrading from Pythran 0.10.0 to 0.11.0 makes the problem go away for me.
Thanks, I'll try that!
In scipy's `pyproject.toml` it explicitly says to use pythran 0.10:
```
    "pythran>=0.10.0,<0.11.0",
```
Is that safe to ignore?
Yes it is. We put upper bounds on all build requirements in release branches, because that's the only way to keep "build from sdist" working long-term. But if the build succeeds in Spack or any other packaging system, there's no need to honor those upper bounds.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-pythran/package.py b/var/spack/repos/builtin/packages/py-pythran/package.py
--- a/var/spack/repos/builtin/packages/py-pythran/package.py
+++ b/var/spack/repos/builtin/packages/py-pythran/package.py
@@ -14,6 +14,7 @@ class PyPythran(PythonPackage):
     homepage = "https://github.com/serge-sans-paille/pythran"
     pypi     = "pythran/pythran-0.9.11.tar.gz"
 
+    version('0.11.0', sha256='0b2cba712e09f7630879dff69f268460bfe34a6d6000451b47d598558a92a875')
     version('0.10.0', sha256='9dac8e1d50f33d4676003e350b1f0c878ce113e6f907920e92dc103352cac5bf')
     version('0.9.12', sha256='5d50dc74dca1d3f902941865acbae981fc24cceeb9d54673d68d6b5c8c1b0001')
     version('0.9.11', sha256='a317f91e2aade9f6550dc3bf40b5caeb45b7e012daf27e2b3e4ad928edb01667')
@@ -50,6 +51,9 @@ class PyPythran(PythonPackage):
     # https://github.com/serge-sans-paille/pythran/pull/1856
     patch('omp.patch', when='@0.9.10:0.9.12')
 
+    # https://github.com/serge-sans-paille/pythran/issues/1937
+    conflicts('%apple-clang@13:', when='@:0.10')
+
     def patch(self):
         # Compiler is used at run-time to determine name of OpenMP library to search for
         cfg_file = join_path('pythran', 'pythran-{0}.cfg'.format(sys.platform))


Test patch: