Opened 9 years ago

Closed 8 years ago

#13309 closed defect (duplicate)

Build Sage on OS X Mountain Lion

Reported by: hedtke Owned by: GeorgSWeber
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: build Keywords:
Cc: jhpalmieri, yomcat, minz Merged in:
Authors: Reviewers: Dmitrii Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jhpalmieri)

To build Sage on OS X Mountain Lion: update to latest Mountain Lion (10.8.2 as of Sept 19) and Xcode (4.5). Use the new scipy spkg from #13541.

Attachments (3)

mercurial-2.2.2.p0.log (49.1 KB) - added by hedtke 9 years ago.
trac_13309-scipy.patch (1.4 KB) - added by jhpalmieri 9 years ago.
patch for scipy spkg; for review only
trac_13309-scipy.0.11.0.patch (2.8 KB) - added by jhpalmieri 9 years ago.
patch for 0.11.0 scipy spkg

Download all attachments as: .zip

Change History (27)

Changed 9 years ago by hedtke

comment:1 Changed 9 years ago by leif

  • Cc jhpalmieri yomcat added

MacOS X 10.8 is not yet a supported platform, also because XCode seems to currently be broken on it; see several recent posts on sage-release.

comment:2 Changed 9 years ago by leif

We should probably make this a meta-ticket.

comment:3 Changed 9 years ago by jdemeyer

Can anybody give remote access to such a system?

comment:4 Changed 9 years ago by jdemeyer

  • Priority changed from blocker to critical

Given no work has been done here, I don't think we should let it block the sage-5.3 release.

comment:5 Changed 9 years ago by chsorger

There is a subtle change in Mountain Lion which defaults to that system header files will use Objective C syntax constructs although we are compiling just pure C. This explains the build error in mercurial above. Setting the compiler flag OS_OBJECT_USE_OBJC=0 reverts this change, so that setting (globally, as I guess there is only pure C in sage)

export CFLAGS="-DOS_OBJECT_USE_OBJC=0"
make

will compile mercurial.

A second build error occurred in gd-2.0.35.p7 where the header file fontconfig/fontconfig.h was not found. If you experience this, adding the include /opt/X11/include helps to compile gd but induces a version incompatibility between the fontconfig and freetype later when starting sage. A workaround for me was to compile fontconfig into the sage local tree using the correct free type libs and then continue with make.

A third error occurred during compilation of scipy, where Mountain Lion does not specify the correct accelerators. Here the following helps.

export CPPFLAGS="-D__ACCELERATE__"
make clean
make

After that sage 5.3 compiled (at least on my 10.8.1).

comment:6 Changed 9 years ago by jhpalmieri

  • Description modified (diff)
  • Status changed from new to needs_review

After upgrading to the latest Mountain Lion (10.8.2) and the latest Xcode (4.5 (4G182)), many of these problems are going away for me. Note that I do not have any version of X11 installed on my machine, which is perhaps good (I don't have any problem with gd, fontconfig, etc.) but perhaps not (there is a small issue with matplotlib).

For me, I need chsorger's fix for scipy, and I have a new spkg ready – see the ticket description for the URL and see the attachments for the difference between the old spkg and the new one. There also seems to be a slightly different, but similar, fix in an unreleased upstream version: see http://projects.scipy.org/scipy/ticket/1710.

Also, when matplotlib is being installed, I get a window saying

To open "gs," you need to install X11.
Would you like to install X11 now?

It turns out that on this machine, /usr/local/bin/gs was a link to /usr/local/bin/gs-X11, and changing the link to point to /usr/local/bin/gs-noX11 fixed the problem.

Other than that, everything seems to work, at least on this machine.

Last edited 9 years ago by jhpalmieri (previous) (diff)

Changed 9 years ago by jhpalmieri

patch for scipy spkg; for review only

comment:7 Changed 9 years ago by chsorger

Indeed, upgrading to 10.8.2 and XCode 4.5 worked. No need to specify the compiler flag OS_OBJECT_USE_OBJC any more (apparently Apple silently corrected this with the update). Also jhpalmieri's patch for scipy works very well, so no need to specify by hand the accelerator flag later!

I still run into gd complaining about the missing fontconfig/fontconfig.h file. But on my machine I installed Quartz (Apple no longer installs X11 by default) so that this is obviously related to this. On the other hand, I need X11 for programs like surf/surfex I use. I also installed poppler through brew (which in turn installed fontconfig and free type) as I compile texmaker on my own which depends on poppler. In short, this problem about gd is probably very much related to my own config. Anyhow, I found a workaround for this, so that sage happily compiles now.

comment:8 Changed 9 years ago by yomcat

I have X11 installed (XQuartz 2.7.3 (xorg-server 1.12.4) to be exact), and both gd and matplotlib build without issues. The build hasn't finished yet, but it's looking good. I haven't done anything to X11. I just installed the one that Apple linked me to when I got that notice jhpalmieri got. So a standard install, including X11/XQuartz, causes no issues.

Oh, Sage 5.4-beta1 and XCode 4.5 on 10.8.2.

Update: Built fine, with no errors. The docs are building now.

Last edited 9 years ago by yomcat (previous) (diff)

comment:9 Changed 9 years ago by jhpalmieri

  • Description modified (diff)
  • Summary changed from Build fails on Mountain Lion to Build Sage on OS X Mountain Lion

comment:10 Changed 9 years ago by jhpalmieri

  • Description modified (diff)

I've posted an experimental spkg for version 0.11.0 of scipy. This is experimental because I haven't tried it out very much. It builds on OS X 10.7, OS X 10.8, and on sage.math, but I haven't run any doctests yet.

Changed 9 years ago by jhpalmieri

patch for 0.11.0 scipy spkg

comment:11 Changed 9 years ago by jhpalmieri

The new scipy spkg requires a few modifications to doctests, which I'll probably get to later today. Maybe I'll move all of that (i.e., upgrading scipy) to another ticket.

comment:12 Changed 9 years ago by jhpalmieri

  • Description modified (diff)

See #13541 for version 0.11.0 of scipy. I wonder if we should just make that a dependency for this ticket, and ignore the scipy spkg here.

comment:13 Changed 9 years ago by minz

  • Cc minz added

comment:14 Changed 8 years ago by saliola

New iMac, updated to 10.8.2, trying to install Sage.

First issue: there is a new OSX "feature" that puts the machine to sleep during long-running tasks like compiling software, big downloads, Time Machine backups, .... Any ideas on how to get around this? I don't really have the time or patience to wake the machine every 15 minutes. From what I've read, setting the computer to never go to sleep doesn't seem to help either.

comment:15 follow-up: Changed 8 years ago by chsorger

Saliola, use the new command "caffeinate" (see man caffeinate).

comment:16 in reply to: ↑ 15 Changed 8 years ago by saliola

  • Work issues set to add caffeinate to installation guide

Replying to chsorger:

Saliola, use the new command "caffeinate" (see man caffeinate).

Thanks! I guess we need to mention this in the installation guide. I'll put this in the "work issues" field for now so that we don't forget, and I'll continue with the review.

comment:17 follow-up: Changed 8 years ago by saliola

iMac, 10.8.2. Works great.

Here is what I did:

  1. install XCode from the App Store
  2. install the XCode command line tools
  3. download and extract sage-5.4.rc2.tar
  4. switch to $SAGE_ROOT/spkg/standard directory and delete the scipy package (this step is not needed, I think)
  5. download the scipy spkg from #13541 into $SAGE_ROOT/spkg/standard
  6. caffeinate make

Notes:

  1. I used the spkg from #13541 because it has a positive review and will likely be merged into version 5.5.
  2. caffeinate prevents the machine from sleeping during the compilation: see here.

Is there anything else that needs to be checked before I set this to positive review?

comment:18 Changed 8 years ago by jhpalmieri

Two possible ideas, although these could go on new tickets instead: we could always use caffeinate on Mountain Lion, with a patch like this to the root repository:

  • spkg/install

    diff --git a/spkg/install b/spkg/install
    a b echo "*** ALL ENVIRONMENT VARIABLES BEFO 
    481481env | sort
    482482echo "***********************************************"
    483483
     484# Use 'caffeinate' to prevent sleep if on OS X Mountain Lion.
     485CAFFEINATE=''
     486if [ `uname` = "Darwin" ]; then
     487    DARWIN_VERSION=`uname -r | cut '-d.' -f1`
     488    if [ $DARWIN_VERSION -eq 12 ]; then
     489       CAFFEINATE=caffeinate
     490    fi
     491fi
     492
    484493###############################################################################
    485494# NOW do the actual build:
    486495###############################################################################
    487 time $MAKE "$@"
     496time $CAFFEINATE $MAKE "$@"
    488497if [ $? -ne 0 ]; then
    489498    echo >&2 "Error building Sage."
    490499    exit 1

We could also try to avoid potential issues with gs pointing to gs-X11 by creating a new link, for example with this possible change to the matplotlib spkg:

  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b if [ "x$SAGE64" = xyes ]; then 
    1212   LDFLAGS="-m64 "; export LDFLAGS
    1313fi
    1414
     15# If on OS X Mountain Lion: see if 'gs' points to
     16# /usr/local/bin/gs-X11. If so, link instead to
     17# /usr/local/bin/gs-noX11.
     18if [ `uname` = "Darwin" ]; then
     19    DARWIN_VERSION=`uname -r | cut '-d.' -f1`
     20    GS=`command -v gs`
     21    GSNOX11=`command -v gs-noX11`
     22    if [ $DARWIN_VERSION -eq 12 ] && [ `readlink "$GS"` = "gs-X11" ] && [ -x "$GSNOX11" ]; then
     23       ln -s "$GSNOX11" "$SAGE_LOCAL"/bin/gs
     24    fi
     25fi
     26
    1527# Write a configuration file to src/setup.cfg
    1628python make-setup-config.py
    1729

I'm not sure about this second idea, though, because the user might actually have X11 installed, so we would want a more sophisticated check. The linbox configure script also calls gs, so we would need a similar change there.

comment:19 in reply to: ↑ 17 Changed 8 years ago by dimpase

Replying to saliola:

iMac, 10.8.2. Works great. Is there anything else that needs to be checked before I set this to positive review?

I'd also check that the package/patches continues to build on usual systems (say, Debian Linux). Or you can just give it positive review as it is, assuming that the author was careful to check this.

comment:20 follow-up: Changed 8 years ago by jhpalmieri

  • Description modified (diff)

This ticket no longer contains any patches or packages. It just points out the scipy spkg from #13541 (which already has a positive review). So I'm not sure what we need to do to close this ticket. Get a buildbot running Mountain Lion? Close now as "works for me"? Add information and/or patches re caffeinate?

comment:21 in reply to: ↑ 20 Changed 8 years ago by dimpase

  • Status changed from needs_review to positive_review

Replying to jhpalmieri:

This ticket no longer contains any patches or packages. It just points out the scipy spkg from #13541 (which already has a positive review). So I'm not sure what we need to do to close this ticket. Get a buildbot running Mountain Lion? Close now as "works for me"? Add information and/or patches re caffeinate?

I'm giving it a positive review. I suppose it's better to open a separate ticket on the caffeinate issue. (I'm not doing it, as I don't have OSX 10.8 machine available, sorry.)

comment:22 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.4 to sage-duplicate/invalid/wontfix
  • Reviewers set to Dmitrii Pasechnik

comment:23 Changed 8 years ago by jdemeyer

  • Work issues add caffeinate to installation guide deleted

Paul-Olivier Dehaye is kindly providing an OS X 10.8 buildslave

comment:24 Changed 8 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.