Thursday 2 July 2009

Building Stackless Python 2.6.2 on Bluehost

With the idea of running an instance of my MUD codebase on my Bluehost account loosely in mind, I started off by compiling Stackless Python. The steps I took are listed here, in case I have to do it again.

  1. I downloaded and compiled svn following these instructions. However, I didn't need to do this and could have just downloaded the source code archive.

  2. I checked out Stackless' Python 2.6 branch:
    > svn checkout http://svn.python.org/projects/stackless/tags/python-2.6.2/
    Again, I didn't need to do this and could have just downloaded one of the "exported" source archives available for download from the Stackless web site.

  3. I started the process of building the Stackless source code:

    > ./configure --prefix=/home/USERNAME/system --enable-shared --with-threads &>~/make.log

    Bluehost shares machines between hosted sites. There's no VPS. So I do not have access to many, if any, directories outside of my home directory. For this reason, I direct the install to the "system" subdirectory under my home directory. This is actually the model used by the SVN install, and I am taking advantage of it.

    As we pay for all bandwidth used in New Zealand, I make sure to redirect all output so that it isn't displayed in my SSH connection.

  4. The next step is to compile the Stackless source code:

    > make &>~/make2.log

    Again, all output is redirected to a file.

    Surprisingly, this actually errored. The linking step failed to find the "slp_safe_pickle" symbol to link against. One of the options I enabled when editing "Modules/Setup", triggered its usage.

    It turns out the file "Stackless/pickling/safe_pickle.c" is not actually compiled. Adding it to "Makefile.pre.in", doing a "make clean" and then a "goto step 3" resulted in a successful compilation. I'll have to make sure I check that into the Stackless SVN branches.

  5. Doing a "make install".

  6. Trying out the compiled command. There's already a "python2.6" provided by Bluehost, so I either needed to override that or add an alias. I chose to add an alias of "stackless2.6":

    > cd ~/system/bin
    > ln -s stackless2.6 python2.6


    Now to try the command:

    > cd ~/
    > stackless2.6


    This failed because it can't find the Python 2.6 shared library. I used to know all the commands related to dealing with these sorts of things, but unfortunately I've forgotten it all.

    A bit of googling got me this:

    > ldd stackless2.6
    libpython2.6.so.1.0 => something about being not found
    libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000003876600000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003876400000)
    libutil.so.1 => /lib64/libutil.so.1 (0x0000003878500000)
    libm.so.6 => /lib64/tls/libm.so.6 (0x0000003876200000)
    libc.so.6 => /lib64/tls/libc.so.6 (0x0000003875f00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003875d00000)


    This was probably no help, as the error given when I tried to run the command probably included the name of the shared object it couldn't find.

  7. Edited "~/.bash_profile" to add "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/system/lib" and "export LD_LIBRARY_PATH" entry. To getting this to kick in I exited the SSH session and started a new one.

  8. Now "stackless2.6" works.
Success. Now the next step is to try running the MUD.

No comments:

Post a Comment