Build from source on Apple Silicon M3

70 views
Skip to first unread message

Trevor Karn

unread,
May 19, 2024, 10:04:58 PMMay 19
to sage-devel
Hi all,

I am trying to build from source on Apple Silicon M3. As predicted by several sources (below), `gfortran` fails to build on Apple Silicon. 

After running `./configure` from SAGE_ROOT, I see the line:

gfortran:                       no suitable system package; standard, SPKG version 12.2.0 will be installed

Then when I `make`, the build fails with output:

  [gfortran-12.2.0]   ********************************************************************************

  [gfortran-12.2.0]   Error building gfortran-12.2.0

  [gfortran-12.2.0]   ********************************************************************************

  [gfortran-12.2.0]   

  [gfortran-12.2.0]   real 0m49.588s

  [gfortran-12.2.0]   user 2m35.894s

  [gfortran-12.2.0]   sys 1m22.419s

  [gfortran-12.2.0]   ************************************************************************

  [gfortran-12.2.0]   Error building package gfortran-12.2.0

  [gfortran-12.2.0]   ************************************************************************


The following lines in config.log seems relevant:

## Checking whether SageMath should install SPKG gfortran... ##
configure:18136: checking the version of gfortran
configure:18172: Installing gfortran because gfortran is version 14, which is too recent for this version of Sage
configure:18206: no suitable system package found for SPKG gfortran
configure:18331: checking whether any of gfortran is installed as or will be installed as SPKG
configure:110356: result: gfortran:                       no suitable system package; standard, SPKG version 12.2.0 will be installed

Since the build wanted to install SPKG version 12.2.0 and thought 14 was "too recent for this version of Sage" I thought I would try `brew install gcc@12`, so that a "suitable system package" would be available. After running `./configure` again I still see 

gfortran:                       no suitable system package; standard, SPKG version 12.2.0 will be installed

Then `make` fails again as predicted.

How can I use either the homebrew gcc@12 or gcc@14 in the build process? Is this done by setting the `FC` environment variable? If so, to what value should I set it? (I tried FC=gcc@12, and still had the same problem.)

Log files are attached.

Thanks!

-Trevor

Sources predicting that `gfortran` installation will fail:
config.log
gfortran-12.2.0.log

Matthias Koeppe

unread,
May 19, 2024, 10:44:20 PMMay 19
to sage-devel

Trevor Karn

unread,
May 20, 2024, 12:20:01 AMMay 20
to sage-devel
Thanks Matthias! I can build off of commit a8a8dd875a
Reply all
Reply to author
Forward
0 new messages