Opened 12 years ago
Last modified 6 years ago
#3924 needs_work task
[with patch; needs work] Build Python as a framework build on OS X
Reported by: | dphilp | Owned by: | jkantor |
---|---|---|---|
Priority: | minor | Milestone: | sage-6.4 |
Component: | build | Keywords: | framework |
Cc: | dphilp, prabhu, cswiercz | Merged in: | |
Authors: | prabhu | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Build Python as a framework build on OS X.
spkg up at
http://sage.math.washington.edu/home/wstein/patches/prabhu/
This needs thorough testing. In particular, try building sage from scratch with this spkg. Also, worry about upgrading from one sage version to another.
Anyway, ASAP I think this should be made the standard version of python for OS X, so that we can get matplotlib + full native gui support by default. Plus, we should provide an optional spkg that makes it trivial to make nice native GUI apps on OS X (??).
Attachments (2)
Change History (25)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
This is the command that pruduced the error.
gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-2.5/C/base.o build/temp.macosx-10.3-i386-2.5/C/dense.o build/temp.macosx-10.3-i386-2.5/C/sparse.o -L/Users/dphilp/sage-3.0.3fo/local/lib -L/Users/dphilp/sage-3.0.3fo/local/lib/gcc-lib/i386-apple-darwin8.10.3/4.0.3/ -lm -llapack -lblas -lf95 -o build/lib.macosx-10.3-i386-2.5/cvxopt/base.so
comment:3 Changed 12 years ago by
Can crash tthrough the cvxopt errors by adding extern declarations in some of the source files.
I think this is a complete list:
in src/C/base.c,
PyTypeObject matrix_tp ; PyTypeObject spmatrix_tp ;
both get an extern.
In dense.c, PyTypeObject spmatrix_tp ;
gets an extern.
In dense.c and sparse.c, PyObject *base_mod;
gets an extern.
comment:4 Changed 12 years ago by
It builds and sage works with two warnings and some dsage badness:
WARNING: Readline services not available on this platform. WARNING: The auto-indent feature requires the readline library
failed doctests:
sage -t devel/sage/sage/dsage/tests/testdoc.py ********************************************************************** File "/Users/dphilp/sage-3.0.3fo/tmp/testdoc.py", line 14: sage: a Expected: 5 Got: No output. ********************************************************************** File "/Users/dphilp/sage-3.0.3fo/tmp/testdoc.py", line 33: sage: j Expected: 10 Got: No output. **********************************************************************
comment:5 Changed 12 years ago by
Readline fix. Python's spkg needs a couple of lines:
LDFLAGS="-L/Users/dphilp/sage-3.0.3fo/local/lib $LDFLAGS" export LDFLAGS CPPFLAGS="-I/Users/dphilp/sage-3.0.3fo/local/include $CPPFLAGS" export CPPFLAGS
comment:6 Changed 12 years ago by
The last has been committed as a general fix to python's build by mabshoff.
comment:7 Changed 12 years ago by
And that also fixes dsage's doctest trouble.
comment:8 Changed 12 years ago by
Patches required to get this working. (Sorry I don't know how to do the pretty red/green bizzo.)
python.spkg/spkg-install:
49a50,56 > # (OS X only) If SAGE_PYTHON_FRAMEWORK is set, compile sage as a framework > if [ `uname` = "Darwin" -a $SAGE_PYTHON_FRAMEWORK ] ; then > echo "Building python as a framework with --enable-framework=$SAGE_LOCAL/Frameworks" > FRAMEWORK_BUILD_OPTION="--enable-framework=$SAGE_LOCAL/Frameworks" > fi > > 74c81,82 < --with-gcc="gcc -m64" --disable-toolbox-glue --- > --with-gcc="gcc -m64" --disable-toolbox-glue \ > $FRAMEWORK_BUILD_OPTION 80c88,89 < ./configure $EXTRAFLAGS --prefix="$SAGE_LOCAL" --without-libpng --enable-unicode=ucs4 --- > ./configure $EXTRAFLAGS --prefix="$SAGE_LOCAL" --without-libpng --enable-unicode=ucs4 \ > $FRAMEWORK_BUILD_OPTION 109a119,132 > # (OS X only) If SAGE_PYTHON_FRAMEWORK the symlink created above will be left dangling > if [ $SAGE_PYTHON_FRAMEWORK ] ; then > ln -s python2.5 ../Frameworks/Python.framework/Versions/Current/lib/python2.5 > fi > > > cd $SAGE_LOCAL/include > > # (OS X only) If SAGE_PYTHON_FRAMEWORK, we need to point to the framework headers > if [ $SAGE_PYTHON_FRAMEWORK ] ; then > ln -s python2.5 ../Frameworks/Python.framework/Versions/Current/include/python2.5 > fi >
sage.spkg/sagebuild.py:
509c509,514 < safesymlink('../../../../devel/sage/build/sage','local/lib/python/site-packages/sage') --- > if env.options['SAGE_PYTHON_FRAMEWORK'] != 'yes' : > safesymlink('../../../../devel/sage/build/sage','local/lib/python/site-packages/sage') > else: > safesymlink( > '../../../../../../devel/sage/build/sage', > 'local/Frameworks/Python.framework/Versions/Current/lib/python/site-packages/sage')
And a bunch of edits to cvxopt, which are apparently fixed in version 1.0.
comment:9 Changed 12 years ago by
Slightly better in python.spkg/spkg-install:
> # (OS X only) If SAGE_PYTHON_FRAMEWORK is set, compile sage as a framework > if [ `uname` = "Darwin" -a "$SAGE_PYTHON_FRAMEWORK" = "yes" ] ; then > echo "Building python as a framework with --enable-framework=$SAGE_LOCAL/Frameworks" > FRAMEWORK_BUILD_OPTION="--enable-framework=$SAGE_LOCAL/Frameworks" > fi
comment:10 Changed 12 years ago by
if [ "$SAGE_PYTHON_FRAMEWORK" = "yes" ] ; then
throughout
comment:11 Changed 12 years ago by
correction to: sage.spkg/sagebuild.py
> if os.environ.get('SAGE_PYTHON_FRAMEWORK') != 'yes' : > safesymlink('../../../../devel/sage/build/sage','local/lib/python/site-packages/sage') > else: > safesymlink( > '../../../../../../devel/sage/build/sage', > 'local/Frameworks/Python.framework/Versions/Current/lib/python/site-packages/sage')
comment:12 Changed 12 years ago by
I suck. python.spkg/spkg-install
> # (OS X only) If SAGE_PYTHON_FRAMEWORK the symlink created above will be left dangling > if [ $SAGE_PYTHON_FRAMEWORK ] ; then > ln -s python2.5 ../Frameworks/Python.framework/Versions/Current/lib/python2.5 > fi > > > cd $SAGE_LOCAL/include > > # (OS X only) If SAGE_PYTHON_FRAMEWORK, we need to point to the framework headers > if [ $SAGE_PYTHON_FRAMEWORK ] ; then > ln -s python2.5 ../Frameworks/Python.framework/Versions/Current/include/python2.5 > fi
Changed 12 years ago by
Changed 12 years ago by
comment:13 Changed 11 years ago by
- Cc prabhu added
- Description modified (diff)
- Summary changed from making sage on os x build, when python is built as a framework to On OS X, build Sage as a framework build
This was the original mess of a ticket description:
I'm trying to build sage on mac with a shareable python library. The current version, being built without the --enable-framework option, cannot be linked to other libraries because of the environ variable. I think getting this working would be useful, and I would like eventually to see it the default build on OS X.
The following recipe works, though it is clearly a defective approach:
- build vanilla sage from source
- edit the spkg/standard/python-2.5....spkg/spkg-install file to include the --enable-framework=SAGE_ROOT/local/Frameworks
- rebuild sage. This creates SAGE_ROOT/Frameworks/Python.framework
- all doctests pass, and I can link to libpython from boost python
Ideally, the following steps would work:
- edit the spkg/standard/python-2.5....spkg/spkg-install file to include the --enable-framework= SAGE_ROOT/local/Frameworks
- build sage.
It doesn't work so simply. I've managed to help it along a few steps, but am stuck with cvxopt
- The build of mercurial crashes. When it crashes, create two symlinks:
1a. local/lib/python2.5 ---> local/Frameworks/Python.framework/Versions/Current/lib/python2.5/
1b. local/include/python2.5 ---> local/Frameworks/Python.framework/Versions/Current/include/python2.5/
1c. Restart make
- The build of the sage package crashes, with a similar error.
2a. Delete the busted symlink at local/Frameworks/Python.framework/Versions/Current/lib/python2.5/site-packages/sage
2b. Create a symlink: local/Frameworks/Python.framework/Versions/Current/lib/python2.5/site-packages/sage --->devel/sage/build/sage
2c. Delete half-built files, restart make.
- The build of cvxopt crashes, with a duplicate symbol error. I'm not in a position to debug this one.
Any attention appreciated! For my part, I can muddle along with the duplicate builds but I would like to get this working.
D
comment:14 Changed 11 years ago by
- Summary changed from On OS X, build Sage as a framework build to [with patch; needs review] Build Python as a framework build on OS X
comment:15 Changed 11 years ago by
- Milestone changed from sage-wishlist to sage-4.1.2
comment:16 Changed 11 years ago by
- Cc cswiercz added
comment:17 Changed 10 years ago by
- Status changed from needs_review to needs_work
Since we have upgraded to python-2.6, I think this needs to be rebased at least. I am interested in testing an updated version.
comment:18 Changed 10 years ago by
- Summary changed from [with patch; needs review] Build Python as a framework build on OS X to [with patch; needs work] Build Python as a framework build on OS X
comment:20 Changed 7 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:21 Changed 6 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:22 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:23 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
The duplicate symbol error is this: ld: duplicate symbol _matrix_tp in build/temp.macosx-10.3-i386-2.5/C/dense.o and build/temp.macosx-10.3-i386-2.5/C/base.o
It is the first error, until then, gcc happily chugs along.