Skip to content
mschwartz edited this page Nov 24, 2011 · 34 revisions

Building SilkJS

Currently SilkJS builds on Ubuntu/Linux and Mac OSX. Building for Ubuntu is rather straightforward, thanks to the apt package management system. Building for OSX is a bit more complicated as MacPorts is required as well as downloading and manually compiling libraries that SilkJS links with.

Building for Ubuntu

These instructions are for Ubuntu Oneiric, though they will work for other versions of Ubuntu as well. I like to build my C/C++ projects in my ~mschwartz/src directory. Feel free to adapt these instructions to suit your preferences.

See these instructions for how to build v8 with gyp: http://code.google.com/p/v8/wiki/BuildingWithGYP

  1. sudo apt-get install build-essential
  2. sudo apt-get install subversion
  3. mkdir src
  4. cd src
  5. svn checkout http://v8.googlecode.com/svn/trunk/ v8-read-only
  6. cd v8-read-only
  7. make dependencies
  8. GYP_GENERATORS=make make x64.release (can do make ia32.release for 32-bit version)
  9. cd ~/src
  10. sudo apt-get install git
  11. git clone git@github.com:mschwartz/SilkJS.git SilkJS

The following prerequisites must be installed before building SilkJS:

  1. sudo apt-get install libmm-dev
  2. sudo apt-get install libmysqlclient-dev
  3. sudo apt-get install libgd2-xpm-dev
  4. sudo apt-get install libncurses5-dev
  5. sudo apt-get install libssl-dev
  6. sudo apt-get install apache2-util

The apache2-util package installs the ab program, which can be used to benchmark SilkJS and other HTTP servers.

SilkJS should now build:

  1. cd ~/src/SilkJS
  2. make

To see it works:

  1. ./SilkJS httpd/main.js
  2. ab -t 30 -c 50 -k http://localhost:9090/anchor.png

Building for OSX

Building for OSX is much more complicated, and there may be some issues with the new gyp build system that prevent SilkJS from being built for OSX using gyp.

According to the gyp build instructions page (for v8): "trying to build x64 targets on Mac currently fails."

That said...

First install Xcode from the App Store. It's free.

Next, install the command line binary version of SubVersion from this page: http://www.wandisco.com/subversion/download#osx

Make sure to edit your ~/.profile to include this line at the end: export PATH=/opt/subversion/bin:$PATH

Then close and open your shell window again.

Prerequisites

  1. cd ~
  2. mkdir src
  3. download scons-2.1.0.tar.gz from http://scons.org to your ~/src directory
  4. cd src && tar xzvfp scons-2.1.0.tar.gz
  5. cd scons-2.1.0
  6. sudo python setup.py install

Building the dependent libraries:

  1. download mm_1.4.2.orig.tar.gz to your ~/src directory

  2. cd ~/src && tar xzvfp mm_1.4.2.orig.tar.gz

  3. cd mm-1.4.2

  4. ./configure

  5. make

  6. sudo make install

  7. download mysql-5.1.58.tar.gz to your ~/src directory

  8. cd ~/src && tar xzvfp mysql-5.1.58.tar.gz

  9. cd mysql-5.1.58

  10. ./configure

  11. make

  12. sudo make install

  13. download libjpeg8_8b.orig.tar.gz to your ~/src directory

  14. cd ~/src && tar xzvfp libjpeg8_8b.orig.tar.gz

  15. cd jpeg-8b

  16. ./configure

  17. make

  18. sudo make install

  19. download libgd2_2.0.36rc1dfsg.orig.tar.gz to your ~/src directory

  20. cd /src && tar xzvfp libgd2_2.0.36rc1~dfsg.orig.tar.gz

  21. cd libgd2_2.0.36rc1dfsg.orig.tar.gz

  22. ./configure

  23. make

  24. sudo make install

Build V8

  1. svn checkout http://v8.googlecode.com/svn/trunk/ v8-read-only
  2. cd v8-read-only
  3. scons arch=x64

Build SilkJS

  1. git clone git@github.com:mschwartz/SilkJS.git SilkJS
  2. cd SilkJS
  3. make -f Makefile.osx