Timestretch Logo Atom Visuals
 Home  Site News  Articles  Desktop Pictures  Erik's Artwork  Music  Software 

Site News
+ Articles
12 inch PowerBook G4 Review + Airport Extreme
Apple Vrs Dell Notebooks
Apple, Please Open up the iPod API!
Asm Programming Using Jmp/Call
Assembler Programming for Intel and PPC on OSX
- Building SpiderMonkey Javascript 1.6 on MacOS X
Canon ZR10 Quick Review
iPod Review... (2)
OS X & Linux Features Compared
PHP, MySQL, and Smarty Programming Intro
Spam Graph
Web Development with MySQL and PHP4 and MacOS X
Writing Secure PHP Applications
Desktop Pictures... (4)
Erik's Artwork
Music
Software... (4)

Search:
Site News:
· Asm Programming Using Jmp/Call
05/04/2008
· LidWakeOff: prevent Macs from Accidently Waking
12/09/2007
· Building SpiderMonkey Javascript 1.6 on MacOS X
05/26/2007
· Assembler Programming for Intel and PPC
05/14/2007
· Url2thumb - Generate Thumbnails from URLs
09/22/2006
· Ruby, Io, Python, Java, C Benchmark
09/22/2005
· Linux on iPod review from xlr8yourmac
12/27/2004
· Writing Secure PHP Applications
03/29/2004
 

Site News | RSS


Home > Articles >

Building SpiderMonkey Javascript 1.6 on MacOS X

I wanted to run a Javascript version of a Mandelbrot program that was submitted to me for my Fractal Benchmark page. Unfortunately, I ran into trouble compiling SpiderMonkey, Mozilla's Javascript interpreter. Here's how I finally got it working on MacOS X.

This Didn't Just Work™

The included instructions to compile it are very simple. Just download, extract and make. But unfortunately the version provided doesn't work with MacOS X.

curl -O http://ftp.mozilla.org/pub/mozilla.org/js/js-1.60.tar.gz
tar -zxvf js-1.60.tar.gz
cd js/src
make -f Makefile.ref

I got the following error. Crap!

libtool: unrecognized option `-framework'
Try `libtool --help' for more information.
make[1]: *** [Darwin_DBG.OBJ/libjs.so] Error 1
make: *** [all] Error 2

At this point, I tried plan B, which is utilize Darwin Ports. Evidently the newest version shown is js-1.5 instead of 1.6. Unfortunately, it couldn't find a version to download anywhere. See spidermonkey on darwinports if you want to go down this route.

sudo port install spidermonkey
...
Error: Target com.apple.fetch returned: fetch failed
Error: /opt/local/bin/port: Status 1 encountered during processing.

Determined Googling Yields a Patch

After some determined Googling, I found the following patch was checked in later to fix it. Unfortunately I can't find the link now. Here's the patch.

diff -r js/src/config/Darwin.mk js.working/src/config/Darwin.mk
52c52,53
< MKSHLIB = libtool $(XMKSHLIBOPTS) -framework System
---
> MKSHLIB = $(CC) -dynamiclib $(XMKSHLIBOPTS) -framework System
> SO_SUFFIX = dylib

diff -r js/src/jsatom.c js.working/src/jsatom.c
924,925c924,925
< jsrefcount js_atom_map_count;
< jsrefcount js_atom_map_hash_table_count;
---
> static jsrefcount js_atom_map_count;
> static jsrefcount js_atom_map_hash_table_count;

Patched Javascript SpiderMonkey 1.6

For your convenience, I've provided a patched version you can download and build. Just copy-and-paste the following into your terminal. (Tested on MacOS X 10.4.9 on 2007-05-26.)

curl -O http://www.timestretch.com/software/js-1.60-MacOSX-Patch.tar.gz
tar -zxvf js-1.60-MacOSX-Patch.tar.gz
cd js-1.60-MacOSX-Patch/src
make -f Makefile.ref
sudo mv Darwin_DBG.OBJ/js /usr/local/bin/

Comments

Determined Googling Yields a Patch 11/05/07
Dan

When I try those commands in the Terminal, I get this error:
cat: ../../dist/Darwin_DBG.OBJ/nspr/Version: No such file or directory

Is there a version of NSPR as well? Thanks.


Building SpiderMonkey Javascript 1.6 on MacOS X 06/16/08
Alan

As of June 2008, SpiderMonkey 1.7 builds just fine under MacPorts


Leave a Comment

Show Comment Form

© 1996-2008 Timestretch.com
About