Differences between revisions 12 and 13
Revision 12 as of 2011-11-23 14:32:25
Size: 4656
Editor: 62
Comment: add ContributorGroup link
Revision 13 as of 2018-12-17 18:22:43
Size: 0
Editor: JoanTouzet
Comment: See http://docs.couchdb.org/en/stable/install/index.html and https://github.com/apache/couchdb-pkg/tree/master/js
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<Include(EditTheWiki)>>

## page was renamed from InstallingSpiderMonkeyFromSource

== Installing from sources ==

 1. Get one of the source tarballs from http://ftp.mozilla.org/pub/mozilla.org/js/ (1.7.0 or 1.8.0-rc1 will do).
 1. Unpack the tarball. Note that once extracted the source are in the directory "js", without the expected version suffix.
 1. Go to the js/src directory.
 {{{
cd js/src
}}}
 1. Build SpiderMonkey. There is no default Makefile, use Makefile.ref. The default build is debug, use BUILD_OPT=1 for an optimized build.
 {{{
make BUILD_OPT=1 -f Makefile.ref
}}}
 1. Install SpiderMonkey. Instead of "install" the target to use is "export". Instead of PREFIX the target directory is specified with JS_DIST.
 {{{
sudo make BUILD_OPT=1 JS_DIST=/usr/local -f Makefile.ref export
}}}

== Notes when installing on OS X ==

 * The export needs to be run as root so use $ sudo sh
 * When running ./configure for couchdb you will need to use the --with-js-include and --with-js-lib options
 * You will need to make sure /usr/local/spidermonkey/lib is in DYLD_LIBRARY_PATH {{{export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/spidermonkey/lib}}}
 * If you're still getting {{{dyld: Library not loaded: Darwin_OPT.OBJ/libjs.dylib}}} when trying to start couchdb, run {{{ranlib /usr/local/spidermonkey/libjs.a}}}

== Notes when installing on Linux ==

It would be best if you can install the SpiderMonkey libraries via your system's package management system, eg:

{{{
apt-get install libmozjs-dev
}}}

Or:

{{{
yum install js-devel
}}}

Warning: Yum may install an older version of SpiderMonkey (1.5) that doesn't work with CouchDB. If you see build errors related to JSOPTION_NATIVE_BRANCH_CALLBACK, you will need to build a newer version of SpiderMonkey as mentioned above.

However, if you need to install from source you should make sure spidermonkey's lib directory is in LD_LIBRARY_PATH:

{{{
export LD_LIBRARY_PATH=/usr/local/spidermonkey/lib
}}}

Or if this does not work for you, set the /lib and /include locations when running ./configure by using something similar to:

{{{
./configure --with-js-lib=/usr/local/spidermonkey/lib --with-js-include=/usr/local/spidermonkey/include
}}}

If you get a message like this during "yum install js-devel":

{{{
No package js-devel available.
Nothing to do
}}}

you may need to add a yum repository. Add rpmforge.repo in /etc/yum.repos.d containing:

{{{
# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
# URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
baseurl = ftp://ftp.pbone.net/mirror/atrpms.net/el5-i386/atrpms/stable
enabled = 1
protect = 0
gpgcheck = 0
}}}

(Put "x86_64" instead of "i386" if when appropriate.)

Now run:

{{{
yum clean all
yum install js-devel
}}}

and you should be OK.

=== Installing on Linux for CouchDB versions >= 1.1 ===

Directions adapted from:
 * https://developer.mozilla.org/En/SpiderMonkey/Build_Documentation
 * https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Linux_Prerequisites

Process:

 1. Add RPMForge repo as detailed above (for mercurial, a prerequisite of SpiderMonkey)
 1. Install SpiderMonkey prerequisites (copied from above link)
 {{{
yum install \
  cvs zip gcc-c++ glib2-devel gtk2-devel fontconfig-devel libnotify-devel \
  libIDL-devel alsa-lib-devel libXt-devel freetype-devel pkgconfig \
  dbus-glib-devel curl-devel autoconf213 xorg-x11-proto-devel libX11-devel \
  libXau-devel libXext-devel wireless-tools-devel glibc-static libstdc++-static yasm \
  mesa-libGL-devel esound-libs esound-devel ccache mercurial
}}}
 1. Download a version of SpiderMonkey >= 1.8.5 (CouchDB's ./configure script looks for mozjs185 to determine JS library existence)
 {{{
curl -L -O http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
}}}
 1. Unpack SpiderMonkey
 {{{
tar xvf js185-1.0.0.tar.gz

cd js-1.8.5/js/src
}}}
 1. Install. 'make install' is needed to move the final files into position, despite it being omitted from Mozilla's process
 {{{
autoconf-2.13
./configure
make
make install
}}}
 1. Use the following ./configure line for CouchDB
 {{{
./configure --with-erlang=/wherever/your/erlang/install/is --with-js-lib=/usr/local/lib/ --with-js-include=/usr/local/include/js/
}}}

== Notes when installing on Android ==

Please see the Android-specific "installing from source" instructions. Since support for Android was added fairly recently to Spidermonkey and NSPR, the above notes won't be of much help to you.