Compiling Stackless on Mac OS Intel

I’m a bit fooling around with Stackless and spend some time trying to compile it. Hopefully this post might help other folks trying to build it on Intel Mac OS 10.5.

If you are just like me and only read the instructions after the first attempt, you’ll probably run in the following error:

./Stackless/platf/switch_x86_unix.h:37: error: PIC register 'ebx' clobbered in 'asm'

There is a hack which just involves removing the ‘ebx’ from line 37, but that’s what it is: just a hack. Looking further in the mailing lists, I found some further hints. Actually, it was all there in the ./configure --help output.

Using the latest SVN checkout I used the following ./configure option line. Note that I’m installing in /opt/stackless, because you don’t want to screw up your other billion Python installations!

$ ./configure --prefix=/opt/stackless --enable-framework --enable-stacklessfewerregisters

I tried the --enable-universalsdk option, but it failed for the PPC architecture. Once Stackless’ Python is installed, and you’ll launch the python CLI, you’ll notice the lack of readline support. Readline is GPL so doesn’t fit Mac OS to much. I learned from another old blog post how to make it work but links don’t work there anymore. So I installed it through Darwin ports first:

$ sudo port install py25-readline

That only works when you actually have Python 2.5 installed from the ports before. Well, it will compile everything new for you in /opt/local. Let me know how you did it without ports!

Next, you’ll need to make a symbolic link:

$ cd /opt/stackless/lib/python2.5/site-packages
$ ln -s /opt/local/lib/python2.5/site-packages/readline.so .

Well, that’s it!