openblas fail on build from source

144 views
Skip to first unread message

Aaron Lauve

unread,
Jul 10, 2025, 12:12:49 PMJul 10
to sage-devel
Hi there!

I'm running macOS 15.5 (sequoia), installing sagemath from git repository with homebrew. 

***************************************************************

Error building Sage.


The following package(s) may have failed to build (not necessarily

during this run of 'make all-start'):


* package:         openblas-0.3.28

  last build time: Jul 10 10:59

  log file:        /Applications/sage/logs/pkgs/openblas-0.3.28.log

  build directory: /Applications/sage/local/var/tmp/sage/build/openblas-0.3.28


log attached.

FWIW, I did install openblas with homebrew and did run `source .homebrew-build-env` and `make reconfigure` before running `make` from the sage directory. In case it's relevant, here's what 'brew has to say about openblas:

lauve@edinburgh sage % brew info openblas

==> openblas: stable 0.3.30 (bottled), HEAD [keg-only]

Optimized BLAS library

https://www.openblas.net/

Installed

/opt/homebrew/Cellar/openblas/0.3.30 (24 files, 50.4MB)

  Poured from bottle using the formulae.brew.sh API on 2025-07-10 at 10:45:39

From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/openblas.rb

License: BSD-3-Clause AND BSD-2-Clause-Views AND BSD-3-Clause-Open-MPI AND BSD-2-Clause

==> Dependencies

Required: gcc

==> Options

--HEAD

Install HEAD version

==> Caveats

openblas is keg-only, which means it was not symlinked into /opt/homebrew,

because macOS provides BLAS in Accelerate.framework.


For compilers to find openblas you may need to set:

  export LDFLAGS="-L/opt/homebrew/opt/openblas/lib"

  export CPPFLAGS="-I/opt/homebrew/opt/openblas/include"


For pkg-config to find openblas you may need to set:

  export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig"



Many thanks,
Aaron

Aaron Lauve

unread,
Jul 10, 2025, 12:16:23 PMJul 10
to sage-devel
oops. forgot to attach the log. and then GoogleGroups complained it was too long.
I'm attaching 'head -n1000' and 'tail -n1000' instead of the full log. Hope that's helpful.

open-blas-head.log
open-blas-tail.log

Dima Pasechnik

unread,
Jul 10, 2025, 1:31:26 PMJul 10
to sage-...@googlegroups.com, ala...@luc.edu
Hi Aaron,
thanks for the report.
The email interface to google groups allows bigger attachments, by the way.
(you can also email these logs directly to me)

There could be several reasons for all this, but first of all, it's
good to understand why the Homebrew's openblas is not accepted.
Can you send us the top-level config.log ?

As far as building from source is concerned, I assume you use gfortran
from Homebrew, right?
It could be that 1.3.28 is too old for your OS/hardware, and we need
to bump our package version.

Last but not the least, I'm at the moment working on allowing the user
to rather use the Apple Accelerate framework instead of openblas, see
https://github.com/dimpase/sage/tree/accel_wip
If you're interested in testing the latter, I can provide more instructions.

Best
Dima
https://pasechnik.info/dima/





On Thu, Jul 10, 2025 at 11:16 AM Aaron Lauve <la...@math.luc.edu> wrote:
>
> oops. forgot to attach the log. and then GoogleGroups complained it was too long.
> I'm attaching 'head -n1000' and 'tail -n1000' instead of the full log. Hope that's helpful.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-devel/f5c7a22b-2dee-425d-bd0b-e540cffbce5fn%40googlegroups.com.

Dima Pasechnik

unread,
Jul 10, 2025, 1:56:42 PMJul 10
to Lauve, Aaron, sage-...@googlegroups.com
On Thu, Jul 10, 2025 at 12:05 PM Lauve, Aaron <ala...@luc.edu> wrote:
>
> Thanks, Dima.
>
>
>
> “Yes” to using gfortran provided by homebrew (at least I presume)
>
> Here’s what brew has to say about that:
>
>
>
> lauve@edinburgh sage % brew info gfortran
>
> ==> gcc: stable 15.1.0, HEAD
>
> GNU compiler collection
>
> https://gcc.gnu.org/
>
> Installed
>
> /opt/homebrew/Cellar/gcc/15.1.0 (1,957 files, 492.3MB) *
>
> Poured from bottle using the formulae.brew.sh API on 2025-06-24 at 09:16:18
>
> From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/gcc.rb
>
> License: GPL-3.0-or-later WITH GCC-exception-3.1
>
> ==> Dependencies
>
> Build: make ✘
>
> Required: gmp ✔, isl ✔, libmpc ✔, mpfr ✔, zstd ✔
>
> ==> Options
>
> --HEAD
>
> Install HEAD version
>
>
>
> I notice that ‘gcc’ mentioned above is 15.1.0 while the relevant line in the config file is 14.2.0.
14.2.0 is Sage's version of gfortran, but there are lines

real_configure:11002: checking for gfortran
real_configure:11023: found /opt/homebrew/bin/gfortran
real_configure:11035: result: gfortran
real_configure:11061: checking for Fortran compiler version
real_configure:11070: gfortran --version >&5
GNU Fortran (Homebrew GCC 15.1.0) 15.1.0
[...]
real_configure:18788: will use system package and not install SPKG gfortran

which really say what it is, and what's going to be used.

>
> Attaching the toplevel config.log file.

right, I knew about this, I mentioned to Homebrew people that it's a bug:
https://github.com/Homebrew/homebrew-core/issues/209091
but they decided not to do anything about it.

The problem is that `openblas.pc` supplied by them does not work with
Apple's "gcc", i.e. clang.
It only works with "real" gcc, which we'd rather avoid using in order
not to create even more mess than what's our
current build system already is.
A quick an dirty fix is to replace their `openblas.pc` with the
corrected one, where openmp is not mentioned
at all - in the same vein as done in https://github.com/sagemath/sage/pull/40397
(I'll post such a file somewhere)

As OpenBLAS people were more keen to listen at
https://github.com/Homebrew/homebrew-core/issues/209091 they
https://github.com/OpenMathLib/OpenBLAS/pull/5180
and so it won't be hard to create a custom Homebrew tap with the
alternative, working with clang, configuration.
Although I think Accelerate is not the better path to go forward.


>
>
>
>
>
> Also, maybe “yes” to being an Apple Accelerate Guinea pig. Let’s see what transpires…

Thanks! I've just made a draft PR from the branch I mentioned
https://github.com/sagemath/sage/pull/40397

Would most appreciate feedback from you and any other volunteers.

Cheers,
Dima


>
>
>
>
>
>
>
> --
>
> Aaron Lauve (he/him/his)
>
> Drop in for a visit
>
> 773.508.3727 | BVM 501 | ala...@luc.edu
>
> ~~~~~~~~~~
>
> Associate Professor and Graduate Program Director for Mathematics
>
> Department of Mathematics & Statistics
>
> Loyola University Chicago
>
>
>
> From: Dima Pasechnik <dim...@gmail.com>
> Date: Thursday, July 10, 2025 at 11:54 AM
> To: sage-...@googlegroups.com <sage-...@googlegroups.com>, Lauve, Aaron <ala...@luc.edu>
> Subject: Re: [sage-devel] Re: openblas fail on build from source
>
> [You don't often get email from dim...@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi Aaron,
> thanks for the report.
> The email interface to google groups allows bigger attachments, by the way.
> (you can also email these logs directly to me)
>
> There could be several reasons for all this, but first of all, it's
> good to understand why the Homebrew's openblas is not accepted.
> Can you send us the top-level config.log ?
>
> As far as building from source is concerned, I assume you use gfortran
> from Homebrew, right?
> It could be that 1.3.28 is too old for your OS/hardware, and we need
> to bump our package version.
>
> Last but not the least, I'm at the moment working on allowing the user
> to rather use the Apple Accelerate framework instead of openblas, see
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdimpase%2Fsage%2Ftree%2Faccel_wip&data=05%7C02%7Calauve%40luc.edu%7C66bdbab0def2439a0b0b08ddbfd27cfa%7C021f4fe32b9c48248378bbcf9ec5accb%7C0%7C0%7C638877632994015794%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=hfdKe%2FfqH%2BrfN%2Fbi7gZXn1xaFoZm%2FcshCLKopIqAegQ%3D&reserved=0
> If you're interested in testing the latter, I can provide more instructions.
>
> Best
> Dima
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpasechnik.info%2Fdima%2F&data=05%7C02%7Calauve%40luc.edu%7C66bdbab0def2439a0b0b08ddbfd27cfa%7C021f4fe32b9c48248378bbcf9ec5accb%7C0%7C0%7C638877632994054935%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ppL6jxXxs2%2F2Ppv5K95jvyzWJxiSZ9UdjWAPHC%2BnC04%3D&reserved=0
>
>
>
>
>
> On Thu, Jul 10, 2025 at 11:16 AM Aaron Lauve <la...@math.luc.edu> wrote:
> >
> > oops. forgot to attach the log. and then GoogleGroups complained it was too long.
> > I'm attaching 'head -n1000' and 'tail -n1000' instead of the full log. Hope that's helpful.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> > To view this discussion visit https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fsage-devel%2Ff5c7a22b-2dee-425d-bd0b-e540cffbce5fn%2540googlegroups.com&data=05%7C02%7Calauve%40luc.edu%7C66bdbab0def2439a0b0b08ddbfd27cfa%7C021f4fe32b9c48248378bbcf9ec5accb%7C0%7C0%7C638877632994081750%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Iwm2GGTj%2FyADuVPv8aPns0uF5bnTXdHMF6kttW1lpok%3D&reserved=0.

Aaron Lauve

unread,
Jul 31, 2025, 10:57:24 AMJul 31
to sage-devel
https://github.com/sagemath/sage/pull/40397

(abbreviated) error logs attached.
install-head.log
scipy-1.15.2.log
install-tail.log

Dima Pasechnik

unread,
Aug 1, 2025, 1:58:53 PMAug 1
to sage-...@googlegroups.com
from your log:

./meson.build:80:0: ERROR: Compiler gfortran cannot compile programs.
[scipy-1.15.2] [spkg-install]
[scipy-1.15.2] [spkg-install] A full log can be found at /Applications/sage/local/var/lib/sage/venv-python3.13/var/tmp/sage/build/scipy-1.15.2/src/.mesonpy-7kk9_dof/meson-logs/meson-log.txt

Can you post the latter file, and the top level
config.log ?

Aaron Lauve

unread,
Aug 1, 2025, 2:58:51 PMAug 1
to sage-devel
Thanks, Dima,

requested config log attached.
I cannot find the meson log file in the location requested:

lauve@edinburgh src % pwd

/Applications/sage/local/var/lib/sage/venv-python3.13/var/tmp/sage/build/scipy-1.15.2/src


lauve@edinburgh src % ls -al

total 288

drwxr-xr-x  22 lauve  admin    704 Jul 31 09:21 .

drwxr-xr-x  24 lauve  admin    768 Aug  1 13:41 ..

drwxr-xr-x   4 lauve  admin    128 Jul 31 09:21 .devcontainer

drwxr-xr-x   6 lauve  admin    192 Jul 31 09:21 benchmarks

-rw-r--r--   1 lauve  admin   1277 Jul 31 09:21 CITATION.bib

-rw-r--r--   1 lauve  admin   1112 Jul 31 09:21 CONTRIBUTING.rst

-rw-r--r--   1 lauve  admin  59699 Jul 31 09:21 dev.py

drwxr-xr-x   2 lauve  admin     64 Jul 31 09:21 dist

drwxr-xr-x   6 lauve  admin    192 Jul 31 09:21 doc

-rw-r--r--   1 lauve  admin   1536 Jul 31 09:21 LICENSE.txt

-rw-r--r--   1 lauve  admin  12881 Jul 31 09:21 LICENSES_bundled.txt

-rw-r--r--   1 lauve  admin   6168 Jul 31 09:21 meson.build

-rw-r--r--   1 lauve  admin    759 Jul 31 09:21 meson.options

-rw-r--r--   1 lauve  admin  13973 Jul 31 09:21 mypy.ini

-rw-r--r--   1 lauve  admin   8511 Jul 31 09:21 PKG-INFO

-rw-r--r--   1 lauve  admin   6263 Jul 31 09:21 pyproject.toml

-rw-r--r--   1 lauve  admin   1270 Jul 31 09:21 pytest.ini

-rw-r--r--   1 lauve  admin   3576 Jul 31 09:21 README.rst

drwxr-xr-x   9 lauve  admin    288 Jul 31 09:21 requirements

drwxr-xr-x  30 lauve  admin    960 Jul 31 09:21 scipy

drwxr-xr-x   3 lauve  admin     96 Jul 31 09:21 subprojects

drwxr-xr-x  24 lauve  admin    768 Jul 31 09:21 tools



I'm attaching *some* meson log file, found in the usual sage/logs/pkgs/ directory


config.log
meson_python-0.17.1.log

Dima Pasechnik

unread,
Aug 1, 2025, 4:08:38 PMAug 1
to sage-...@googlegroups.com, la...@math.luc.edu
It's rather obscure, to me at least, bug.
Your gfortran is rejected by the scipy build script. Does "brew doctor" report that everything is OK with your Homebrew install?

Aaron Lauve

unread,
Aug 1, 2025, 4:21:41 PMAug 1
to sage-devel
Dima,
I think the answer to your question is "essentially, yes"...

lauve@edinburgh pkgs % brew doctor   

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry or file an issue; just ignore this. Thanks!


Warning: Some installed kegs have no formulae!

This means they were either deleted or installed manually.

You should find replacements for the following formulae:

  arb


Warning: Some installed formulae are deprecated or disabled.

You should find replacements for the following formulae:

  icu4c@76

  six


lauve@edinburgh pkgs % brew info gcc

==> gcc: stable 15.1.0, HEAD

GNU compiler collection

https://gcc.gnu.org/

Installed

/opt/homebrew/Cellar/gcc/15.1.0 (1,957 files, 492.3MB) *

  Poured from bottle using the formulae.brew.sh API on 2025-06-24 at 09:16:18

From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/gcc.rb

License: GPL-3.0-or-later WITH GCC-exception-3.1

==> Dependencies

Build: make

Required: gmp , isl , libmpc , mpfr , zstd

==> Options

--HEAD

Install HEAD version

==> Analytics

install: 81,926 (30 days), 289,275 (90 days), 1,317,053 (365 days)

install-on-request: 45,610 (30 days), 163,188 (90 days), 680,062 (365 days)

build-error: 3,245 (30 days)

lauve@edinburgh pkgs % which gfortran

/opt/homebrew/bin/gfortran


Dima Pasechnik

unread,
Aug 2, 2025, 1:42:56 AMAug 2
to sage-...@googlegroups.com, Aaron Lauve
I've rebased <https://github.com/sagemath/sage/pull/40397>
over the latest beta, maybe it helps. If no, and
if upgrading xcode followed by upgrading homebrew didn't work,
I would have tried to build scipy separately,
just to see if it works.
Perhaps upgrading scipy might help (either to 1.15.3, or to the latest, 1.16.1)


Aaron Lauve

unread,
Aug 7, 2025, 12:17:47 PMAug 7
to sage-devel
Success!

pulled latest version, upgraded brew and command-line tools.
    also (maybe all of the above wasn't necessary) I read the instructions in #40397 and ran
        "export PKG_CONFIG_PATH=`pwd`/build/platform/macos/pkgconfig:$PKG_CONFIG_PATH"
    which I didn't do the first time.

Thanks again, Dima, et al.,

Aaron
Reply all
Reply to author
Forward
0 new messages