Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
3-manifolds
GitHub Repository: 3-manifolds/Sage_macOS
Path: blob/main/Sage_framework/README
170 views
In order for Sage to run on older macOS systems we specify a minimum
target of 10.12 and we need to disable AVX2 instructions.  (There are
Intel CPUs which are new enough to run Big Sur yet do not support
AVX2.)  We can do this for givaro with SAGE_FAT_BINARY=yes but that
does not work with gmp because the gmp spkg ignores SAGE_FAT_BINARY on
macOS.  So we need to also set GMP_CONFIGURE.  Also, the givaro
package disables sse and sse2 when SAGE_FAT_BINARY is set, but that is
unnecessary (according to conda) so we modify the spkg.

Setting the minimum OS version target has become trickier now that Apple's
ld accepts the new -platform_version option.  Just using -mmacosx-version-min=10.9
is no longer sufficient.  A number of libraries, including libreadline and
libhistory will be built with the minimum target set to 11.0 instead of
10.9.  This can be worked around by setting *both* the CFLAGS and LDFLAGS
environment variables.  Also, in order to have a working distutils it is necessary
to provide the same information in the MACOS_DEPLOYMENT_TARGET environment
variable.

In order to avoid illegal instruction crashes, we currently modify the spkg-install.in
files for the givaro and openblas packages.  The portability.patch should be
applied in the sage git repository before building.

Below are the build commands we use.  We use the "build" make target
because we do not need to build documentation.  (The app uses the
documentation on the web.)

$ export GMP_CONFIGURE="--enable-fat"
$ export SAGE_FAT_BINARY="yes"
$ export CFLAGS="-mmacosx-version-min=10.12 -mno-avx2 -mno-bmi2"
$ export LDFLAGS="-Wl,-platform_version,macos,10.12,11.3"
$ export MACOSX_DEPLOYMENT_TARGET="10.12"
$ export MAKE="make -j8"
$ ./configure --without-system-python3
$ make build