Thursday, December 17, 2009

Building Stackless Python on a PS3 (PPC Linux)

I have recently gotten my hands on a PlayStation 3 that I am trying to use as a surrogate[1] in my Scavenger system. The first thing I did was to install Ubuntu Linux 9.10 on it, and the next step was then getting Stackless Python to compile... Which turned out to be a bit of a bitch ;-)

But after some heavy debugging and googling I found out how to do it:
  1. Download the Stackless source distribution. I used version 2.6.4.

  2. Unpack it somewhere and enter the newly created directory.

  3. $ ./configure --prefix=/where/you/want/it

  4. Edit the file called "Makefile" and change the variable SLPFLAGS to "SLPFLAGS=-fomit-frame-pointer -O2"

  5. make

  6. make install
It's very simple actually, just took me some time to find the solution :-) By the way, if you do not edit the Makefile you get the following error:
./Stackless/core/slp_transfer.c: In function 'slp_transfer':
./Stackless/core/slp_transfer.c:144: error: 31 cannot be used in asm here
./Stackless/core/slp_transfer.c:144: error: 31 cannot be used in asm here
make: *** [Stackless/core/slp_transfer.o] Error 1
Looking at that error the 31 hints at that the save registers code for PPC is trying to save register r31. This is reminiscent of the error you get when compiling Stackless under Mac OS X, but in this case adding the --enable-stacklessfewerregisters option does not work.

[1]: A surrogate in a cyber foraging system is a strong machine that performs heavy work on behalf of the weaker (often mobile) clients.

3 comments:

  1. Sweet! If we could get someone to work with CorePy http://www.corepy.org/, a PS3 should make a nice surrogate!

    ReplyDelete
  2. So Stackless does work, if you follow those instructions? It doesn't need additional assembly language changes?

    ReplyDelete
  3. It seems to be working fine. I have used it to run my Scavenger system and have run a few tests within that system - which have been working 100%

    ReplyDelete