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 ===============

Download and install XCODE 3.2 or higher

download latest stable version of scons from http://www.scons.org/
extract package, cd into directory then run:
# sudo python setup.py install

Check out V8 javascript engine into library
# sudo svn checkout http://v8.googlecode.com/svn/trunk/ /Library/v8

Build V8 with scons
# cd /Library/v8
# sudo scons
# sudo scons sample=shell
# sudo scons d8

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 ==========

install C++ compiler for V8
# sudo apt-get install g++
OR
# sudo yum install distcc.x86_64

install scons for building V8
# sudo apt-get install scons
OR
# sudo yum install scons

Check out V8 from repository
# sudo svn checkout http://v8.googlecode.com/svn/trunk/ /usr/local/v8

Go into v8 directory
# cd /usr/local/v8

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

Create a shortcut for V8

# sudo vi /usr/bin/d8
File content:
—–
#!/bin/bash

/usr/local/v8/d8 $@
—–

Set permissions:
# sudo chmod +x /usr/bin/d8

Done!

Leave a Reply

Security Code: