multi-build/multibuild

LAPACK library is not found for macos builds

MarkWieczorek opened this issue · 5 comments

multibuild is working fine for me with linux, and in the past used to work with macos as well. However, recently, our macos builds started to fail and the culprit appears to be that LAPACK isn't being found in the setup.py file and before compiling some Fortran code.

I tried to update OPENBLAS_VERSION to 0.3.20 in the config.sh file, but that didn't help (I also tried a couple different versions, including one that worked about 6 months ago...).

Any advice would be greatly appreciated!

The main build repo is here: https://github.com/SHTOOLS/build-shtools
The github actions script that runs everything is here: https://github.com/SHTOOLS/build-shtools/blob/master/.github/workflows/build_wheels.yml
And here are the failed builds: https://github.com/SHTOOLS/build-shtools/actions/runs/3023622083 (just ignore the linux ones, they already built and were uploaded to pypi...)

Unfortunately, that didn't work. build_openblas gave the following output, which says that a "newer" version of openblas 0.3.21 is already installed (I specified 0.3.20 in the config file). It also suggested setting some environment variables, but I tried that and it didn't help.

+ build_openblas
+ '[' -e openblas-stamp ']'
+ '[' -n 1 ']'
+ brew install openblas
Warning: openblas 0.3.21 is already installed and up-to-date.
To reinstall 0.3.21, run:
  brew reinstall openblas
+ brew link --force openblas
Warning: Refusing to link macOS provided/shadowed software: openblas
For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

I just tried this again with a new release, and I am having the same problem with macOS not finding LAPACK. As before, the linux builds are working fine.

For info, here is one of the build logs: https://github.com/SHTOOLS/build-shtools/actions/runs/4892537077/jobs/8734407603

with OPENBLAS_VERSION=0.3.21.

The libraries are installed in /usr/local/opt/openblas/lib, but your build of NumPy is looking for them in ['/Users/runner/work/build-shtools/build-shtools/venv/lib', '/usr/local/lib', '/usr/lib']. The distutils-based NumPy build system is going away in the next version of NumPy and the newer meson-based one uses pkg-config. Until then, could you try setting NPY_LAPACK_LIBS and NPY_BLAS_LIBS to /usr/local/opt/openblas/lib ?

I got this to work by setting the LAPACK environment variable in config.sh

    build_openblas
    export LAPACK='/usr/local/opt/openblas'

I saw your message after finding this solution, so its possible that setting NPY_LAPACK_LIBS and NPY_BLAS_LIBS would also work...