Purpose of SAGE_MACOSX_DEPLOYMENT_TARGET

36 views
Skip to first unread message

Zachary Scherr

unread,
Jan 13, 2021, 7:52:31 PM1/13/21
to sage-devel
I've been trying to help out with getting sage to work properly on Mac, and I was curious if anyone can explain the purpose of SAGE_MACOSX_DEPLOYMENT_TARGET to me.

I don't know autoconf at all, but I find that if I configure with --with-system-python3=no
then SAGE_MACOSX_DEPLOYMENT_TARGET gets set to "legacy".  This is presumably because of the lines

    AS_IF([test x$sage_spkg_install_python3 = xno],
          [PYTHON_FOR_VENV="$ac_cv_path_PYTHON3"],
          [SAGE_MACOSX_DEPLOYMENT_TARGET=legacy])
    AC_SUBST([PYTHON_FOR_VENV])
    AC_SUBST([SAGE_MACOSX_DEPLOYMENT_TARGET])

located in build/pkgs/python3/spkg-configure.m4.

As far as I can tell, this leads to all sorts of warnings when doctesting sage.  Specifically, I get lots of warnings like:

    ld: warning: dylib (/usr/local/lib/libmpfr.dylib) was built for newer macOS version (10.15) than being linked (10.9)
    ld: warning: dylib (/usr/local/lib/libgmp.dylib) was built for newer macOS version (10.15) than being linked (10.9)
    ld: warning: dylib (/usr/local/lib/libgmpxx.dylib) was built for newer macOS version (10.15) than being linked (10.9)
    ld: warning: dylib (/usr/local/lib/libgsl.dylib) was built for newer macOS version (10.15) than being linked (10.9)
    ld: warning: dylib (/usr/local/lib/libntl.dylib) was built for newer macOS version (10.15) than being linked (10.9)

now I believe that this is caused by src/bin/sage-env which has the following code:

if [ "$UNAME" = "Darwin" ]; then
  export MACOSX_VERSION=`uname -r | awk -F. '{print $1}'`
  case "$SAGE_MACOSX_DEPLOYMENT_TARGET" in
  legacy)
    # legacy behavior of the Sage distribution.
    # set MACOSX_DEPLOYMENT_TARGET -- if set incorrectly, this can
    # cause lots of random "Abort trap" issues on OSX. see trac
    # #7095 for an example.
    if [ $MACOSX_VERSION -ge 14 ]; then
        # various packages have still have issues with
        # two digit OS X versions
        MACOSX_DEPLOYMENT_TARGET=10.9
    else
        MACOSX_DEPLOYMENT_TARGET=10.$[$MACOSX_VERSION-4]
    fi
    export MACOSX_DEPLOYMENT_TARGET
    ;;
  "")
    # Do nothing
    ;;
  *)
    # A fixed version set at configure time.
    export MACOSX_DEPLOYMENT_TARGET=$SAGE_MACOSX_DEPLOYMENT_TARGET
    ;;
  esac

and I'm trying to understand where all of this is coming from.  The trac ticket this references is 11 years old and so I'm not sure it's an issue any more.

Dima Pasechnik

unread,
Jan 14, 2021, 4:44:09 AM1/14/21
to sage-devel


On Thu, 14 Jan 2021, 00:52 Zachary Scherr, <zsc...@gmail.com> wrote:
I've been trying to help out with getting sage to work properly on Mac, and I was curious if anyone can explain the purpose of SAGE_MACOSX_DEPLOYMENT_TARGET to me.

I don't know autoconf at all, but I find that if I configure with --with-system-python3=no
then SAGE_MACOSX_DEPLOYMENT_TARGET gets set to "legacy".  This is presumably because of the lines

    AS_IF([test x$sage_spkg_install_python3 = xno],
          [PYTHON_FOR_VENV="$ac_cv_path_PYTHON3"],
          [SAGE_MACOSX_DEPLOYMENT_TARGET=legacy])
    AC_SUBST([PYTHON_FOR_VENV])
    AC_SUBST([SAGE_MACOSX_DEPLOYMENT_TARGET])

located in build/pkgs/python3/spkg-configure.m4.

As far as I can tell, this leads to all sorts of warnings when doctesting sage. 

I would treat the very idea of not using an already installed python3 as a legacy option.

But yes, the issue is related to the correct setting of MACOSX_DEPLOYMENT_TARGET - something that only Apple itself understands well :-)


--
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 on the web visit https://groups.google.com/d/msgid/sage-devel/19afd68d-be22-4a98-a3e7-c694fc6135a8n%40googlegroups.com.

Zachary Scherr

unread,
Jan 14, 2021, 3:37:24 PM1/14/21
to sage-devel
That's a fair point.  I guess it's a bit more relevant at the moment since homebrew python is, at least for the time being, no longer suitable and system python3 is only 3.8.  So for people who have homebrew python installed they can't get python 3.9 in sage 9.3 unless they build from source.

In any case, it seems prudent to try to figure out what's going on with MACOSX_DEPLOYMENT_TARGET.  I'll try to investigate to the best of my ability, but I wonder if the problems that led to setting it to 10.9 ten years ago are still relevant today.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages