Installing Google V8 Javascript Engine in Mac OS X and in Linux

This documents describes how to install V8. V8 is Google’s open source JavaScript engine. We use V8 on JotForm to generate form code on the server side.

Installing on Mac OS X

  1. Download and install XCODE 3.2 or higher. Download latest stable version of scons from http://www.scons.org/
  2. Extract package, cd into directory then run:
    # sudo python setup.py install
  3. Check out V8 javascript engine into library
    # sudo svn checkout http://v8.googlecode.com/svn/trunk/ /Library/v8
  4. Build V8 with scons
    # cd /Library/v8
    # sudo scons
    # sudo scons sample=shell
    # sudo scons d8

  5. Create short cut for d8
    # sudo vi /usr/bin/d8

    #!/bin/bash

    /Library/v8/d8 $@

    # sudo chmod +x /usr/bin/d8

Installing on Linux Server

  1. Install C++ compiler for V8
    # sudo apt-get install g++
    OR
    # sudo yum install distcc.x86_64
  2. Install scons for building V8
    # sudo apt-get install scons
    OR
    # sudo yum install scons
  3. Check out V8 from repository
    # sudo svn checkout http://v8.googlecode.com/svn/trunk/ /usr/local/v8
  4. Go into v8 directory
    # cd /usr/local/v8
  5. Build V8 with scons
    # sudo scons

IF you are on 64 bit machine and get an error, run these:

apt-get install libc6-dev-i386
aptitude install lib32stdc++6
ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so

OR

yum install glibc-devel.i386

# sudo scons sample=shell
# sudo scons d8

  1. Create a shortcut for V8
    # sudo vi /usr/bin/d8
    File content:
    —–
    #!/bin/bash
    /usr/local/v8/d8 $@
    —–

  2. Set permissions
    # sudo chmod +x /usr/bin/d8

Done!