Home > Uncategorized > How to install libjs (SpiderMonkey)

How to install libjs (SpiderMonkey)

In Ubuntu 10.04 (Lucid) there’s no deb package for libjs. I needed to use version 1.8 of libjs with MediaTomb. Normally this would mean you download the source code for libjs and “./configure; make; make install” but the source code for libjs 1.8 doesn’t come with a configure script, or with an install target in the Makefile.ref file.

The SpiderMonkey Build Documentation is helpful in getting a build done, but points to some SpiderMonkey manual installation instructions that are no longer available. If you create a file called Makefile in the js/src directory with the contents shown below, you can issue the normal “make install” to install libjs. Better yet, you should install the “checkinstall” package and use:

checkinstall -D make install

This will create a debian package (-D) that does the same thing as “make install”.

Make sure you use a hard tab to indent the lines below “install:” target or else the Makefile won’t work. Since the build result is placed in a subdirectory named based on the system, you might have to adjust the BLD (look for the location of the libjs.so file). The PREFIX should probably be /usr when used with checkinstall, and /usr/local otherwise.

BLD := Linux_All_OPT.OBJ
#PREFIX := /usr/local
PREFIX := /usr
        cp ${BLD}/libjs.so ${PREFIX}/lib
        cp ${BLD}/js ${PREFIX}/bin
        cp ${BLD}/jscpucfg ${PREFIX}/bin
        cp ${BLD}/jskwgen ${PREFIX}/bin
        mkdir -p ${PREFIX}/include/js
        cp *.h ${PREFIX}/include/js
        cp *.tbl ${PREFIX}/include/js
        cp ${BLD}/*.h ${PREFIX}/include/js
Categories: Uncategorized Tags:
  1. Sergio
    November 8th, 2010 at 03:59 | #1

    I Use fedora to build the spidermonket js
    but have a problem
    i paste the code in a Makefile.ref and run
    “make -f Makefile.ref”

    Makefile:5: *** faltando o separador (você pensou em TAB ao invés de 8 espaços?). Pare.

    • Gabriel Burca
      November 8th, 2010 at 20:59 | #2

      If you did a copy-n-paste, you’ll need to change the spaces to real tabs as I explicitly stated in the paragraph right above the makefile.

  2. December 7th, 2010 at 17:49 | #3

    You my friend just saved me hours and hours of work.

    So thankful!!

  3. Dan
    December 7th, 2010 at 21:54 | #4

    The above method did not work for me with with Spider Monkey 1.8.0 RC1

    cp: cannot stat `Linux_All_OPT.OBJ/libjs.so’: No such file or directory

    This did:
    cd js/src
    make BUILD_OPT=1 -f Makefile.ref
    checkinstall -D make BUILD_OPT=1 JS_DIST=/usr -f Makefile.ref export

  4. Adam
    July 18th, 2011 at 01:38 | #5

    For the 1.8.0 RC1, you need to change Linux_All_OPT.OBJ to Linux_All_DBG.OBJ

  5. Steve
    July 29th, 2011 at 12:40 | #6

    Why is build always static? I didn’t configure to be. I’m missing the libjs.so, the output is libjs-static.a

  6. Andy
    April 9th, 2012 at 18:01 | #7
  7. Phil
    July 14th, 2012 at 11:06 | #8

    I’m confused. I’m trying to use the Perl module WWW:Scripter, under Cygwin’s perl, on Windows 7. Scripter uses SpiderMonkey. Firefox uses SpiderMonkey. Is Scripter going to find the libjs library that Firefox uses, which must be installed somewhere on my system? Or do I have to install SpiderMonkey again myself, manually?

  1. May 10th, 2011 at 15:06 | #1
  2. May 19th, 2016 at 18:55 | #2