Building SpiderMonkey on Ubuntu

The following instructions for building SpiderMonkey is not specific to Ubuntu, but same on almost all Unix and Unix-like operating systems.

  • Login to Mozilla CVS servers
    • cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login
  • Pull the sources
    • cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -l mozilla/js/src mozilla/js/src/config mozilla/js/src/editline mozilla/js/src/fdlibm
  • And start the build
    • cd mozilla/js/src && make -f Makefile.ref

If your distribution has GCC 4.1, then you might hit on this bug (jscpucfg.c:374: internal compiler error: in dwarf2out_finish, at
dwarf2out.c:14116) during compilation.

You have two ways to fix it:

  • Upgrade to GCC 4.1.2
  • Or, turn on the optimisation flag while compiling
    • CFLAGS=-O2 make -f Makefile.ref

Installation is really simple.

  • sudo mkdir /usr/local/spidermonkey
  • sudo cp Linux_All_DBG.OBJ/{js,jskwgen,jscpucfg,libjs.so} /usr/local/spidermonkey
  • export PATH=$PATH:/usr/local/spidermonkey

Once the installation is done, you can invoke the shell by running js.

technorati tags:, , , ,

Blogged with Flock

2 Responses to “Building SpiderMonkey on Ubuntu”

  1. mansu Says:

    Other way to fix it is by disabling the -g flag in the optimiser in config.mk.
    I was trying to fix this for the past few days.

    How did you find the solution to this problem?

  2. gopal Says:

    It was pretty easy to find by searching usenet groups since it seemed to be a well known problem (like the GCC 4.0 visibility problem).

Leave a Reply