From: casevh on
On Dec 26, 7:39 am, Benjamin Kaplan <benjamin.kap...(a)case.edu> wrote:
> On Sat, Dec 26, 2009 at 4:57 AM, Mensanator <mensana...(a)aol.com> wrote:
> > On Dec 25, 8:59 pm, Benjamin Kaplan <benjamin.kap...(a)case.edu> wrote:
> >> On Fri, Dec 25, 2009 at 1:19 PM, Mensanator <mensana...(a)aol.com> wrote:
> >> > On Dec 25, 9:25 am, Benjamin Kaplan <benjamin.kap...(a)case.edu> wrote:
> >> >> On Fri, Dec 25, 2009 at 1:48 AM, Mensanator <mensana...(a)aol.com> wrote:
> >> >> > On Dec 24, 10:18 pm, Benjamin Kaplan <benjamin.kap...(a)case.edu> wrote:
> >> >> >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator <mensana...(a)aol.com> wrote:
> >> >> >> > Ok, so I got a MacBook Air.
>
> >> >> >> > Has OS X 10.6 (Snow Leopard) and Python 2.6.1 already installed.
>
> >> >> >> > So I install Xcode, download macports and download gmpy-1.11rc1.
>
> >> >> >> > Following the instructions in mac_build.txt, I do the following:
>
> >> >> >> > - sudo /opt/local/bin/port install gmp
>
> >> >> >> > This works fine.
>
> >> >> >> > Then I do
>
> >> >> >> > - python setup.py install
>
> >> >> >> > This also works (a few warnings, but nothing looked serious).
>
> >> >> >> > Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
> >> >> >> > [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> >> >> >> > Type "help", "copyright", "credits" or "license" for more information.
> >> >> >> >>>> import gmpy
> >> >> >> >>>> gmpy.version()
> >> >> >> > '1.11'
>
> >> >> >> > python gmpy_test.py
> >> >> >> > Unit tests for gmpy 1.11
> >> >> >> > on Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
> >> >> >> > [GCC 4.2.1 (Apple Inc. build 5646)]
> >> >> >> > Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
> >> >> >> > gmpy_test_cvr 151 tests, 0 failures
> >> >> >> > .
> >> >> >> > .
> >> >> >> > .
> >> >> >> > 25 tests in gmpy_test_rnd.__test__.rand
> >> >> >> > 1469 tests in 42 items.
> >> >> >> > 1469 passed and 0 failed.
> >> >> >> > Test passed.
>
> >> >> >> > Looks like a viable gmpy module for 2.6.
>
> >> >> >> > What do I do AFTER I install Python 3.1? Just running python3.1 from
> >> >> >> > the
> >> >> >> > same directory doesn't work.
>
> >> >> >> > I've spent the last 5 days trying to figure that out. I hosed it so
> >> >> >> > bad
> >> >> >> > I somehow wrecked the 2.6 version to the point where it won't even
> >> >> >> > load.
>
> >> >> >> > I just got done doing a factory restore of the entire OS to undo
> >> >> >> > everything
> >> >> >> > I did. Re-did all the above and got it back working. Haven't re-
> >> >> >> > installed 3.1
> >> >> >> > yet.
>
> >> >> >> > Anbody have any idea how to make this work?
>
> >> >> >> Did you run setup.py with python3? Python 3.1 won't install itself as
> >> >> >> the default python install for compatibility reasons so you have to
> >> >> >> run "python3 install setup.py" to install it for that version of
> >> >> >> python.
>
> >> >> > I wondered why there was both python3 and python3.1 in the bin
> >> >> > directory.
>
> >> >> > But why, when I type...
>
> >> >> > $ python3
>
> >> >> > ...do I get...
>
> >> >> > Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04)
> >> >> > [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> >> >> > Type "help", "copyright", "credits" or "license" for more information.
>
> >> >> > [1]+ Stopped python3
>
> >> >> > I get the same result with python3.1.
>
> >> >> > So, no, trying python3 is of no help, same errors as before.
> >> >> > There's hundreds of them, but they start out
>
> >> >> > $ /Library/Frameworks/Python.framework/Versions/3.1/bin/python3
> >> >> > setup.py install
> >> >> > running install
> >> >> > running build
> >> >> > running build_ext
> >> >> > building 'gmpy' extension
> >> >> > creating build/temp.macosx-10.3-fat-3.1
> >> >> > creating build/temp.macosx-10.3-fat-3.1/src
> >> >> > Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/
> >> >> > MacOSX10.4u.sdk
> >> >> > Please check your Xcode installation
> >> >> > gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
> >> >> > fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I./src -I/
> >> >> > opt/local/include -I/Library/Frameworks/Python.framework/Versions/3.1/
> >> >> > include/python3.1 -c src/gmpy.c -o build/temp.macosx-10.3-fat-3.1/src/
> >> >> > gmpy.o
> >> >> > In file included from src/gmpy.c:206:
> >> >> > /Library/Frameworks/Python.framework/Versions/3.1/include/python3..1/
> >> >> > Python.h:11:20: error: limits.h: No such file or directory
> >> >> > /Library/Frameworks/Python.framework/Versions/3.1/include/python3..1/
> >> >> > Python.h:14:2: error: #error "Something's broken. UCHAR_MAX should be
> >> >> > defined in limits.h."
> >> >> > /Library/Frameworks/Python.framework/Versions/3.1/include/python3..1/
> >> >> > Python.h:18:
>
> >> >> > Any other ideas? Do I have to install a separate Python 3?
>
> >> >> That's not a Python 3 problem. It appears to be a problem in the build script.
>
> >> >> > Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/
> >> >> > MacOSX10.4u.sdk
>
> >> >> My guess would be you're on Snow Leopard while the original developer
> >> >> is either on Tiger or Leopard. The script wants to use the 10.4 SDK
> >> >> but Apple only includes the SDKs for the latest 2 versions of OS X.
>
> >> > I just thought of something. Why I am able to do the build for python
> >> > 2.6?
> >> > Wouldn't that also fail for lack of a 10.4 SDK?
>
> >> I think you'd need different C sources for 2.x and 3.x because I think
> >> the C API changed quite a bit.
>
> > I can see that.
>
> >> That might be why it worked for 2.6 but
> >> failed for 3.1
>
> > But Python 2.6 must not care about whether the 10.4SDK
> > exists or not. It must be using 10.5 or 10.6 since they
> > are te only SDKs that do exist.
>
> > As far as different sources, only one set is supplied and
> > it specifically states in the comments that the source
> > supports 3.x. There are, after all, 3.1 versions of the
> > windows installer.
>
> > I certainly woudn't be surprised by the need for seperate
> > sources, but wouldn't such seperate sources have been
> > supplied and seperate setup scripts been provided?
>
> I was just digging though the sources- turns out it is a Python issue.
> GMPY compiles using distutil's makefile.
> /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config/Makefile
>
> That makefile specifies the 10.4 SDK and a MACOSX_DEPLOYMENT_TARGET of
> 10.3. I don't know how you'd fix this to work on all supported
> versions of OS X, but that seems to be the problem.
(I'm one of the GMPY maintainers but I have no access to Macs....)

The same GMPY source should should compile with all version of Python
2.4 and later.

I think the makefile is created when that specific version of Python
is compiled. Was Python 3.1 included with OS X or was it installed
separately? If it was installed separately, was it installed from
macports or python.org?

I have a couple other generic questions.

Is Python 2.6 built as a 32 or 64-bit application? (sys.maxint)

Is the gmp library 32 or 64-bit? (gmpy.gmp_limbsize())

For best performance with large numbers, GMPY should be compiled as a
64-bit application. If Python and gmp are not compiled in 64-bit mode,
you probably will want to compile both of them from source or find 64-
bit versions.

casevh
>
>
>
> >> >> >> > --
> >> >> >> >http://mail.python.org/mailman/listinfo/python-list
>
> >> >> > --
> >> >> >http://mail.python.org/mailman/listinfo/python-list
>
> >> > --
> >> >http://mail.python.org/mailman/listinfo/python-list
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
>

From: Benjamin Kaplan on
On Sat, Dec 26, 2009 at 12:05 PM, casevh <casevh(a)gmail.com> wrote:
> (I'm one of the GMPY maintainers but I have no access to Macs....)
>
> The same GMPY source should should compile with all version of Python
> 2.4 and later.
>

Like I said in the my last post, it appears to be an issue with
distutils distributed with the python.org installer. The makefile
distutils uses to compile C sources specifies the SDK for 10.4, but
Apple only gives the SDKs for the latest two versions of OS X (10.5
and 10.6 right now)

> I think the makefile is created when that specific version of Python
> is compiled. Was Python 3.1 included with OS X or was it installed
> separately? If it was installed separately, was it installed from
> macports or python.org?
>

Python 3 has to be installed separately. The issues appear in the
python.org installer. I haven't tried using Macports yet.

> I have a couple other generic questions.
>
> Is Python 2.6 built as a 32 or 64-bit application? (sys.maxint)
>
> Is the gmp library 32 or 64-bit? (gmpy.gmp_limbsize())
>
> For best performance with large numbers, GMPY should be compiled as a
> 64-bit application. If Python and gmp are not compiled in 64-bit mode,
> you probably will want to compile both of them from source or find 64-
> bit versions.

Macs usually work with Universal binaries. The System's Python 2.6 is
a 3-way binary: ppc, i386, and x86_64. It runs in 64-bit mode when
you're on a Mac with a 64-bit processor and 32-bit mode when you're on
a 32-bit processor. If gmp was built using Macports, then it was
compiled to whatever the system supports, so most likely 64-bit.