Differences between revisions 17 and 18
Revision 17 as of 2008-08-19 16:17:56
Size: 4933
Editor: bi-02pt1
Revision 18 as of 2008-08-19 16:19:19
Size: 4936
Editor: bi-02pt1
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
== Install CouchDB as Erlang Library Directory == == Install CouchDB as an Erlang Library Directory ==

CouchDB does not natively install on Windows but it is possible to install it by hand. Be aware that many unit tests fail due to IO-related features that aren't supported by Erlang on Windows.

Please update this guide as needed, we aim to collect feedback and roll the procedure into the official build.

These instructions currently refer to paths as they'd be set up in a default installation of Erlang OTP 5.6.3, with the couchDB distribution installed at

C:\Program Files\erl5.6.3\lib\couchdb-0.8.1


You will need the following software installed on your system:

Install CouchDB as an Erlang Library Directory

After installing Erlang you should having something similar to:

C:\Program Files\erl5.6.3

Copy the whole CouchDB source tree to:

C:\Program Files\erl5.6.3\lib\couchdb-0.8.1

Make the following empty directory:

C:\Program Files\erl5.6.3\lib\mochiweb-0.01\ebin

Provide ICU to Erlang

From ICU copy icu*.dll (and libeay32.dll for older versions of ICU) to:

C:\Program Files\erl5.6.3\erts-5.6.3\bin

Build SpiderMonkey

The SpiderMonkey distribution's Windows build stuff is broken. See [http://blog.endflow.net/?p=55&lang=en this blog post] for a working js.mak file. Don't bother trying to import the project file into a contemporary Visual Studio; just use the Visual Studio command line tools with the js.mak file referred to above.

CouchDB uses a custom JavaScript driver, which provides unicode and buffering improvements. In the SpiderMonkey distribution, rename src/js.c to src/js.c.bak, and copy C:\Program Files\erl5.6.3\lib\couchdb-0.8.1\src\couchdb\couch_js.c from the CouchDB distribution to src/js.c in the SpiderMonkey distribution. Before running nmake, edit the new js.c and change #include <jsapi.h> to #include "jsapi.h".

Once you've built js.exe and js32.dll, copy them both to

C:\Program Files\erl5.6.3\erts-5.6.3\bin

and rename js.exe to couch_js.exe.

Build couchdb/couch_erl_driver.c

This is a wrapper to provide ICU features to CouchDB.

Here is a binary (no warranty! may burn your eyes out!) built against ICU 4.0 in 32-bit Windows: attachment:couch_erl_driver.dll

The simplest way to build a DLL is to create a Win32 DLL project in an IDE, add couch_erl_driver.c into the project, and change project settings to include the Erlang ERTS and ICU4C header paths. You must also include the various ICU *.lib files to the MSVC linker as inputs. MSVC doesn't know how to create a DLL with unresolved names.

Make the following empty directory:

C:\Program Files\erl5.6.3\lib\couchdb-0.8.1\priv

Copy the DLL to:

C:\Program Files\erl5.6.3\lib\couchdb-0.8.1\priv\couch_erl_driver.dll

Erlang Compilation

Create a the following file:

C:\Program Files\erl5.6.3\lib\couchdb-0.8.1\src\Emakefile

Add the following content:

{'./couchdb/*', [{outdir,"../ebin"}]}.
{'./mochiweb/*', [{outdir,"../../mochiweb-0.01/ebin"}]}.

Launch erl (or werl) and execute the following command to change working directory:

cd("C:/Program Files/erl5.6.3/lib/couchdb-0.8.1/src").

Execute this command to compile CouchDB:



Copy the following file:

C:\Program Files\erl5.6.3\lib\couchdb-0.8.1\etc\couchdb\couch.ini.tpl.in

To this location:

C:/Program Files/erl5.6.3/bin/couch.ini

Edit the file to look something like this:


ConsoleStartupMsg=Apache CouchDB is starting.




DocumentRoot=C:/Program Files/erl5.6.3/lib/couchdb-0.8.1/share/www


UtilDriverDir=C:/Program Files/erl5.6.3/lib/couchdb-0.8.1/priv/


[Couch Query Servers]

javascript=couch_js "C:/Program Files/erl5.6.3/lib/couchdb-0.8.1/share/server/main.js"

Make sure that the DbRootDir exists and that the LogFile can be created.


Launch erl (or werl) and execute the following command:


To check that everything has worked point your web browser to [http://localhost:5984/_utils/index.html] and run the test suite.