Skip to content

Building On Mac OS X

kumar303 edited this page Sep 13, 2010 · 6 revisions

First, make sure you do not have an old version of XUL Runner SDK installed. Check for /usr/local/lib/libjs.dylib and if you can safely remove that file then do so.

Next, build the spidermonkey lib. The easy way is with Mac Ports

sudo port install spidermonkey

The hard way is to build it from souce

Next cd into the python-spidermonkey code and type:

python setup.py build

And to test:

python setup.py test

Which requires nose

NOTE: while building you might get this error:

ld: warning in /opt/local/lib/libjs.dylib, file is not of required architecture

This means your port system installed an i386 lib not a universal one, which is all you need anyway if you are just compiling for use on your local machine. There seems to be no easy way to tell distutils to leave off the -arch ppc (hopefully this can be fixed soon) but you can edit the gcc commands. Just remove -arch ppc so it looks more like:

gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double … etc

Keep running python setup.py build until you have the shared object file: spidermonkey.so

Then run the tests with something like:

export PYTHONPATH=./build/lib.macosx-10.3-fat-2.5/

nosetests

voila et voici

Clone this wiki locally