Python 3.2.1 on MacOSX 10.7.1

Created:

Getting a proper version of python 3.x installed is not as easy as it has been earlier. First of all, you need the Developer package installed (again). This you do by installing XCode 4.x from the MacApp store. I thought I had done so, but could still not find gcc etc in my path. Some people on the net say one should just produce soft links here and there, but I think that would still create those with Xcode 3.x.

Anyone I found that in Launchpad (this weird thing that I do not know what it is really) there was an Install XCode App. I did run it but although it crashed XCode when later running it, it seems to have installed the tools I needed. Make, gcc etc all was where I wanted them.

Next, I of course downloaded Python from the official download page. I did though detect early that that is built without support for wide Unicode characters, so I had to try to built it myself. Here is where things started to go south, although I was successful in the end.

To build Python, you want to have GNU gettext and readline libraries. Both sort of install after ./configure;make;make install, but readline was a problem:

i686-apple-darwin11-llvm-gcc-4.2: -compatibility_version only allowed with -dynamiclib

Some use of Google made me find that someone else had had this problem before, but that was when MacOS based on Darwin 9 was released. You can find what Lucian E. Marin wrote here.

So, up with the editor and change support/shobj-conf to also support Darwin11:

$ diff support/shobj-conf support/shobj-conf~
160c160
< darwin[89]*|darwin10*|darwin11*)
---
> darwin[89]*|darwin10*)
189c189
< 	darwin[789]*|darwin10*|darwin11*)	SHOBJ\_LDFLAGS=''
---
> 	darwin[789]*|darwin10*)	SHOBJ\_LDFLAGS=''

After that, building Python was easy with the following config directive:

$ ./configure --with-wide-unicode --enable-ipv6 --enable-framework

As you can see, I now have the unicode support I wanted:

$ uname -a
Darwin junior.frobbit.se 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11
PDT 2011; root:xnu-1699.22.81~1/RELEASE\_X86\_64 x86\_64
$ which python
/Library/Frameworks/Python.framework/Versions/3.2/bin/python
$ python   
Python 3.2.1 (default, Aug 22 2011, 13:53:40) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxunicode
1114111
>>> 
$