sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 480 forks source link

port Sage to 32 bit OSX 10.5 #1005

Closed 85eec1a4-3d04-4b4d-b711-d4db03337c41 closed 16 years ago

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago

NOTES: The remarks below are enough to get Sage to 100% build on OSX 10.5, and all doctests pass.

The only anomaly is that doctesting the tutorial results in a bunch of error messages like this:

python(15525) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug

These don't cause any doctests to fail, and I observed this only for tut.tex (nothing else).

This is a meta ticket:

Component: porting

Keywords: Leopard

Issue created by migration from https://trac.sagemath.org/ticket/1005

ba94b9bb-195b-4422-a5e2-176920eaa163 commented 17 years ago
comment:2

When this is fixed, inst/inst.tex should be updated; I just changed that file to say that OS X 10.5 is not yet supported.

williamstein commented 17 years ago
comment:3

Some hacks / workarounds:

Crazy hacks to get things to build.  Will figure out right fixes once everything
works, etc.

These come from rpw, me, Mabshoff .

1) FLINT (william stein):
Problem -- Multiple symbols... --
Solution:
   comment out this one line 423 of local/include/gmp.h
/* #define __GMP_EXTERN_INLINE      extern __inline__ */

2) PYTHON (rpw):
Python fails to build:
Solution:
I did
   export CFLAGS="-D__DARWIN_UNIX03"
then in src/ manually did this line again after it failed:
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes  -I. -I./Include   -DPy_BUILD_CORE  -c ./Modules/posixmodule.c -o Modules/posixmodule.o

Note that putting the above CFLAGS lines in spkg-install at the top or in the ./configure
line did *not* work for some reason.

3) GIVARO (rpw and mabshoff):
Problem: Fails to build.
Solution: Add #include "sys/types.h" to the top of
src/src/kernel/zpz/givzpz32std.inl
src/src/kernel/zpz/givzpz32uns.inl
williamstein commented 17 years ago
comment:4
4) Building clisp fails with 

  UNIX error 45: Operation not supported

SOLUTION: 

   cd spkg/build/clisp-*
   cd src/src
   make
   make install

It works.  The problem is that building tee'ing breaks on 10.5. See
http://osdir.com/ml/apple.fink.tracker/2004-12/msg00149.html
williamstein commented 17 years ago
comment:5
5) MAXIMA:

Solution: Exactly the same as for clisp.  This works.
williamstein commented 17 years ago
comment:6

Other broken packages:

lcalc -- fails
flintqs -- fails
scipy -- fails (looks easy to fix)

Everything else builds and Sage starts up.

williamstein commented 17 years ago
comment:7

6) LCALC:

The fix for lcalc is to change the line

cp lcalc* "$SAGE_LOCAL"/bin

in spkg-install to

cp lcalc "$SAGE_LOCAL"/bin

The former was needed when we supported windows (e.g., lcalc.exe), and was sort of hack-ish. The latter works around that there is some small problem with strip on os x, which isn't an issue.

-- William

williamstein commented 17 years ago
comment:8

7) FLINTQS:

The fix for flintqs is the same as for givaro, basically. To the file

    src/lanczos.c

add the following as the first line:

#include "sys/types.h"

Then it builds fine.

williamstein commented 17 years ago

Description changed:

--- 
+++ 
@@ -1 +1,10 @@
+NOTES:  The remarks below are enough to get Sage to 100% build on OSX 10.5.

+
+
+Doctesting the tutorial results in a bunch of error messages like this:
+
+```
+python(15525) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
+*** set a breakpoint in malloc_error_break to debug
+```
williamstein commented 17 years ago
comment:9

8) SCIPY

The final build problem was with Scipy. There is a problem with g95 not working correctly to build some of scipy on 10.5. Fortunately, using gfortran instead does work. So I installed a system-wide gfortran in /usr/local/bin/, then did

   export SAGE_FORTRAN=`which gfortran`
   cd SAGE_ROOT
   rm spkg/installed/fortran*
   sage -f fortran-20070912
   make

and the rest of the build completed fine.

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago

Replying to @sagetrac-mabshoff:

NOTES: The remarks below are enough to get Sage to 100% build on OSX 10.5.

Doctesting the tutorial results in a bunch of error messages like this:

python(15525) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug

Check out https://lists.ubuntu.com/archives/storm/2007-July/000035.html for some pointers how this might be resolved.

Cheers,

Michael

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago
comment:11

There are two potential patches to try out to fix the non-aligned pointer issue:

http://groups.google.com/group/sage-devel/attach/64e42ec65e8a9fa2/no-collect-integer.patch?part=2

http://groups.google.com/group/sage-devel/attach/3cd7a66aa5c1a355/__Pyx_ImportModule-decref-fix.patch?part=2

Both are from Robert Bradshaw, they should get rolled into 2.8.11, so I will open a ticket for them once I get some feedback from Robert.

Cheers,

Michael

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago
comment:12

Pointers toward a potential solution for the flint problem with gmp at link time can be found at

http://lists.apple.com/archives/darwin-dev/2006/Oct/msg00015.html

Cheers,

Michael

williamstein commented 17 years ago
comment:13

NOTE: A binary built on 10.5 will not work on 10.4.

williamstein commented 17 years ago

Description changed:

--- 
+++ 
@@ -1,10 +1,12 @@
-NOTES:  The remarks below are enough to get Sage to 100% build on OSX 10.5.
+NOTES:  The remarks below are enough to get Sage to 100% build on OSX 10.5, and *all doctests pass*. 

-
-Doctesting the tutorial results in a bunch of error messages like this:
+The only anomaly is that doctesting the tutorial results in a bunch of error messages like this:

python(15525) malloc: error for object 0xa023c6d8: Non-aligned pointer being freed set a breakpoint in malloc_error_break to debug

+
+These don't cause any doctests to fail, and I observed this only for tut.tex (nothing else). 
+
williamstein commented 17 years ago
comment:14

I've posted a pre-built version of Sage that was built on Leopard here:

http://sagemath.org/SAGEbin/apple_osx/intel/leopard/

This might be the optimal version of Sage to use on OSX 10.5. It probably won't 100% work without gfortran installed though.

williamstein commented 17 years ago
comment:15

I just tried making some matplotlib plots using athe sage I built on 10.5. I get lots of serious problems. Nothing works. This may be very difficult to resolve; I don't know. This happens both in the notebook and from the command line.

sage: P = point( (0,0) )
sage: show( P )
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
python(5144) malloc: *** error for object 0xa023c6d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug

NOTE: Using sage-2.8.9 that I built on OS X 10.4 the above problem does not occur.

williamstein commented 17 years ago
comment:16

READLINE in GP doesn't work

Yet another problem:

sage: !gp
                       GP/PARI CALCULATOR Version 2.3.2 (released)
               i386 running darwin (ix86/GMP-4.2.1 kernel) 32-bit version
                compiled: Oct 31 2007, gcc-4.0.1 (Apple Inc. build 5465)
                   (readline not compiled in, extended help available)
                             ^^^^^^^^^^^^^^^
williamstein commented 17 years ago
comment:19

Replying to @williamstein:

I just tried making some matplotlib plots using athe sage I built on 10.5.
I get lots of serious problems.

I think this was a result of something involving #1044; I've tested again and I can't replicate this problem at all. So never mind -- matplotlib is fine :-).

williamstein commented 17 years ago
comment:20

From rpw:

Ralf-Philipp Weinmann   
to Jean-Guillaume., sage-devel

show details
     7:21 am (2 hours ago) 
Dear Dr. Dumas,

I've encountered a build problem in Givaro 3.2.6 on MacOS X 10.5. The
uint type used in src/kernel/zpz/givzpz32std.inl for example is not
available unless sys/types.h is included. The following patch fixes
the problem for me:

--- src/kernel/system/givbasictype.h.ORIG       2007-11-01
15:17:57.000000000 +0100
+++ src/kernel/system/givbasictype.h    2007-11-01 15:18:33.000000000 +0100
@@ -11,6 +11,9 @@
 #include "givaro/givconfig.h"

 #include <stdlib.h> // for size_t
+#ifdef MACOSX
+#  include <sys/types.h> // needed on MacOS X 10.5 for uint type
+#endif

 // -- Neutral type: definition of zero and one
 class Neutral {
85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago
comment:21

The givaro issue has been fixed in givaro-3.2.6.p2 for 2.8.11.rc1

Cheers,

Michael

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago

Description changed:

--- 
+++ 
@@ -10,3 +10,7 @@

 These don't cause any doctests to fail, and I observed this only for tut.tex (nothing else). 

+
+This is a meta ticket:
+
+#1056: Givaro 3.2.6 build fix
85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago

Description changed:

--- 
+++ 
@@ -14,3 +14,5 @@
 This is a meta ticket:

 #1056: Givaro 3.2.6 build fix
+#1059: lcacl installation fix
+#1060: flintqs build fix
85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago
comment:24

The lcalc issue has been fixed in lcalc-20070107.p0.spkg

Cheers,

Michael

williamstein commented 17 years ago
comment:25

I've posted a patched python spkg here:

http://sage.math.washington.edu/tmp/python-2.5.1.p8.spkg

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago

Description changed:

--- 
+++ 
@@ -13,6 +13,7 @@

 This is a meta ticket:

-#1056: Givaro 3.2.6 build fix
-#1059: lcacl installation fix
-#1060: flintqs build fix
+* #1056: Givaro 3.2.6 build fix
+* #1059: lcacl installation fix
+* #1060: flintqs build fix
+* #1061: python build fix
williamstein commented 17 years ago
comment:27

I'm posting spkgs here:

http://sage.math.washington.edu/tmp/leopard/

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 17 years ago
comment:28

All the above spkgs have been merged in 2.8.11. The only open issue now is that g95 miscompiles scipy and we need to figure out what to do about this. A binary of gfortran 4.2.2 is 19mb compressed, so that is not the solution.

Cheers,

Michael

williamstein commented 16 years ago
comment:29
Hi,

I just did a test and using the new version of g95 here:
    http://ftp.g95.org/g95-x86-osx.tgz
works fine for building Sage on Leopard OS X 10.5 intel.  
So, we can just update that and stop worrying about require
gfortran on that platform.  Very nice. 

 -- Wiliam
85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 16 years ago
comment:31

The new fortran.spkg at

http://sage.math.washington.edu/home/mabshoff/fortran-20071120.spkg

fixes the last known issue.

Cheers,

Michael

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 16 years ago
comment:33

2.8.13.rc0 builds "out of the box" on bsd.

Cheers,

Michael