couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Building_from_source_on_Windows" by DaveCottlehuber
Date Tue, 03 Jan 2012 00:52:10 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Building_from_source_on_Windows" page has been changed by DaveCottlehuber:
http://wiki.apache.org/couchdb/Building_from_source_on_Windows?action=diff&rev1=2&rev2=3

Comment:
consolidate building form source notes across the wiki

+ <<Include(EditTheWiki)>>
+ 
  <<TableOfContents>>
  
+ = CouchDB 1.0 onwards =
- = Overview =
- 
- This wiki page has been superseded by the [[https://github.com/apache/couchdb/blob/master/INSTALL.Windows|INSTALL.Windows]]
file in the CouchDB source tree, and a [[https://github.com/dch/glazier/readme.md|community-provided]]
build process.
- 
- This page describes how to set up the toolchain, and then build and install CouchDB 1.0.1
or later from source on Windows.
- 
-  * install Microsoft Visual Studio 2008 C++ compiler
-  * install Microsoft Windows 7.0 SDK
-  * install Cygwin toolkit
-  * install Mozilla toolkit
-  * install NSIS and Inno packaging tools
-  * unpack OpenSSL, cURL, ICU dependent libraries
-  * extract Erlang/OTP, wxWidgets, Mozilla Spidermonkey, Apache CouchDB source
- 
- = Warning =
  
  Building CouchDB from source on Windows requires 4 different compilers and
  attention to detail. Significant effort goes into setting up the toolchain
@@ -24, +12 @@

  CouchDB builds ends up with matching Visual C++ Runtime components and a valid
  Side-by-Side (SxS) configuration.
  
-  * always use the Win32 versions of tools unless explicitly mentioned
-  * don't use newer versions of compilers or SDKs unless explicitly mentioned
+ This wiki page has been superseded by the 
+ [[https://github.com/apache/couchdb/blob/master/INSTALL.Windows|INSTALL.Windows]]
+ file in the CouchDB source tree, and a
+ [[https://github.com/dch/glazier/readme.md|community-provided]] build process.
  
+ The remaining notes are provided for historic reference only.
- In most cases you will not want to do this and should use the
- [[Windows_binary_installer]] instead.
  
- = Toolchain =
+ = CouchDB 0.10 to 0.11.2 =
  
- open control panel, and set new environment variables:
+ As of couchdb 0.10, support for Windows is included in the standard build process.  View
[[https://github.com/apache/couchdb/blob/0.10.0/README|README]] in the root of the source
tree for information about the dependencies and how to configure the build process.  In summary,
you will need to:
  
+  * Install the cygwin environment.
- {{{
- CYGWIN="nontsec nodosfilewarning"
- RELAX=c:\relax
- }}}
  
- %RELAX% will be used later on for stashing files; use any sane location without spaces or
special characters.
+  * Install the MS C compiler.
  
- Then download these, and then install in sequence:
+  * Install and possibly build a number of pre-requisites, such as curl, icu, spidermonkey,
etc.
  
+  * get the sources to erlang and couch
-  * Run [[http://www.cygwin.com/setup.exe|Cygwin's setup.exe]] using defaults, and additionally
all of devel, utils/file, utils/patch, editors/vim
-  * Download [[http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso|Microsoft
Visual Studio Express 2008]] and install. You can skip Silverlight and MSSQL.
-  * Install the Windows SDK v7.0 for your architecture (32/64 bit) from either [[http://download.microsoft.com/download/2/E/9/2E911956-F90F-4BFB-8231-E292A7B6F287/GRMSDK_EN_DVD.iso|32
bit SDK]] or [[http://download.microsoft.com/download/2/E/9/2E911956-F90F-4BFB-8231-E292A7B6F287/GRMSDKX_EN_DVD.iso|64
bit SDK]]
-  * save [[http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe|Visual
C++ 2008 SP1 runtime]] to %relax%
-  * Run [[http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe|Mozilla
toolchain]]
-  * If you don't like using vim in cygwin, you may want a unix file-compatible editor such
as [[http://sourceforge.net/projects/notepad-plus/files/notepad%2B%2B%20releases%20binary/|NotePad++]]
- * Add a quick shortcut to Start Menu / All Programs / Visual C++ 2008 Express / Visual Studio
Tools / Visual Studio 2008 Command Prompt -- you'll be using this a lot
  
- = Packaging Tools and Libraries
+  * configure and build erlang according to the instructions.
  
+  * configure and build couch according to the [[https://github.com/apache/couchdb/blob/0.10.0/README|README]]
file in couch
-  * Install [[http://www.slproweb.com/download/Win32OpenSSL-1_0_0d.exe|OpenSSL]] into c:\OpenSSL,
and add to PATH
-  * Unzip [[http://download.icu-project.org/files/icu4c/4.2/icu4c-4_2-Win32-msvc9.zip|ICU]]
into %relax%\icu
-  * Install [[http://www.jrsoftware.org/download.php/is-unicode.exe|Inno5 Packager]] to %relax%\inno5
-  * Install [[http://download.sourceforge.net/project/nsis/NSIS%202/2.46/nsis-2.46-setup.exe|NSIS]]
to %relax%\nsis
-  * Reboot now
  
- = Source =
+ After executing 'make install', you will find a couchdb directory structure inside your
erlang directory - that is, the couch build process simply installs its libraries into the
erlang binaries you previously build.  This directory structure should be ready to roll -
it can be zipped up, packaged by an installer, etc.
  
- Download & keep these handy in %relax%\bits or similar:
+ = Prior to CouchDB 0.10 =
  
+ 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.'''
-  * [[https://github.com/downloads/dch/otp/erlang_otp.r14b01+COUCHDB-963+improved_find_redist.tar.gz|Erlang/OTP
R14B01 with 2 CouchDB-specific patches]]
-  * [[http://curl.haxx.se/download/curl-7.21.5.tar.gz|LibcURL]]
-  * [[http://hg.mozilla.org/tracemonkey/archive/57a6ad20eae9.tar.gz|Mozilla SpiderMonkey
1.8.x]]
-  * [[http://www.erlang.org/download/tcltk85_win32_bin.tar.gz|Erlang Tk/Tcl components]]
-  * [[http://sourceforge.net/projects/wxwindows/files/2.8.11/wxMSW-2.8.11.zip|wxWidgets source]]
-  * [[https://github.com/dch/glazier/blob/master/bits/wxMSW-2.8.11_erlang_overlay.zip|an
overlay for wxWidgets to avoid manual editing]]
  
- = Build Erlang =
+ 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.7.1, with the couchDB distribution installed at
-  * Start a VS2008 prompt & then:
- {{{
- set OPENSSL_PATH=c:\openssl
- set CURL_PATH=%relax%\curl-7.21.6
- set ICU_PATH=%relax%\icu
- set USE_SSLEAY=1
- set USE_OPENSSL=1
  
- set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1
- 
- set INCLUDE=%INCLUDE%;%OPENSSL_PATH%\include\;%CURL_PATH%\include\curl;%ICU_PATH%\include;
- set LIBPATH=%LIBPATH%;%OPENSSL_PATH%\lib;%CURL_PATH%\lib;%ICU_PATH%\lib;
- set LIB=%LIB%;%OPENSSL_PATH%\lib;%CURL_PATH%\lib;%ICU_PATH%\lib;
- 
- c:\cygwin\cygwin.bat
- }}}
- 
- The rest of this guide will run under the cygwin shell. Modify $ERL_TOP as needed.
- 
  {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0
- cd $RELAX
- tar xzf bits/erlang_otp*.tar.gz
- cd erlang_otp
- export ERL_TOP=`pwd`
- 
- echo "skipping gs" > lib/gs/SKIP
- echo "skipping jinterface" > lib/jinterface/SKIP
- 
- eval `./otp_build env_win32`
- 
- ./otp_build autoconf 2>&1 | tee $ERL_TOP/build_autoconf.txt
- ./otp_build configure 2>&1 | tee $ERL_TOP/build_configure.txt
- 
- ./otp_build boot -a  2>&1 | tee $ERL_TOP/build_boot.txt
- ./otp_build release -a  2>&1 | tee $ERL_TOP/build_release.txt
- ./otp_build installer_win32  2>&1 | tee $ERL_TOP/build_installer_win32.txt
- mv --force $ERL_TOP/release/win32/otp_win32_R*.exe $RELAX
- ./release/win32/Install.exe -s 2>&1 | tee -a $ERL_TOP/build_release.txt
- 
  }}}
  
+ == Dependencies ==
+ 
+ You will need the following software installed on your system:
+ 
+   * [[http://www.erlang.org/download.html|Erlang/OTP]]
+   * C Compiler/Linker (such as [[http://gcc.gnu.org/|GCC]] or [[http://msdn.microsoft.com/en-us/visualc/default.aspx|Visual
C++]])
+   * Make (such as [[http://www.gnu.org/software/make/|GNU Make]] or [[http://msdn.microsoft.com/en-us/library/dd9y37ha(VS.71).aspx|nmake]])
+   * [[http://www.openssl.org/|OpenSSL]]
+   * [[http://www.icu-project.org/|ICU]] (Tested with [[http://www.icu-project.org/download/4.0.html|binary
build of 4.2 release]].)
+   * [[http://www.mozilla.org/js/spidermonkey/|SpiderMonkey]]
+ 
+ == Install CouchDB as an Erlang Library Directory ==
+ 
+ After installing Erlang you should having something similar to:
+ 
+ {{{
+ C:\Program Files\erl5.7.1
+ }}}
+ 
+ Copy the whole CouchDB source tree to:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0
+ }}}
+ 
+ Make the following empty directories:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\mochiweb-0.01\ebin
+ }}}
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0\ebin
+ }}}
+ 
+ == Provide ICU to Erlang ==
+ 
+ From ICU copy `icu*.dll` (and `libeay32.dll` for older versions of ICU) to:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\erts-5.7.1\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.7.1\erts-5.7.1\bin
+ }}}
+ 
+ and rename js.exe to couch_js.exe.
+ 
+ ''Here are the binaries built according to the blog post: [[http://dl.getdropbox.com/u/118385/CouchDbBinaries/couchbd_spidermonkey_1.7_win32_32bit.zip|couchbd_spidermonkey_1.7_win32_32bit.zip]]
. Just unzip the contents to the bin directory.''
+ 
+ == Build couchdb/couch_erl_driver.c ==
+ 
+ This is a wrapper to provide ICU features to CouchDB.
+ 
+ ''Here is a binary (no worry! MS bleeding-edge technology proved!) built against ICU 4.2
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.  In Visual Studio 2008 this can be accomplished
by right clicking on the project, choosing properties, expanding the Linker node in the left
panel, selecting Input, and adding the following to the 'Additional Dependencies' field:
+  *icudt.lib 
+  *icuin.lib 
+  *icuio.lib 
+  *icule.lib 
+  *iculx.lib 
+  *icutu.lib 
+  *icuuc.lib 
+ 
+ The erlang include paths for this build for example were 
+ 
+ {{{
+ C:\otp_src_R13B\erts\emulator\sys\win32 
+ C:\otp_src_R13B\erts\emulator\beam
+ }}}
+ 
+ Make the following empty directory:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0\priv
+ }}}
+ 
+ Copy the DLL to:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0\priv\couch_erl_driver.dll
+ }}}
+ 
+ == Erlang Compilation ==
+ 
+ Create a the following file:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0\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.7.1/lib/apache-couchdb-0.9.0/src").
+ }}}
+ 
+ Execute this command to compile CouchDB:
+ 
+ {{{
+ make:all().
+ }}}
+ 
+ == Configuring ==
+ 
+ Copy the following file:
+ 
+ {{{
+ C:\Program Files\erl5.7.1\lib\apache-couchdb-0.9.0\etc\couchdb\default.ini.tpl.in
+ }}}
+ 
+ To this location:
+ 
+ {{{
+ C:/Program Files/erl5.7.1/bin/default.ini
+ }}}
+ 
+ or to this location:
+ 
+ {{{
+ C:/Program Files/erl5.7.1/lib/couchdb-0.9.0/default.ini
+ }}}
+ 
+ Edit the file to look something like this:
+ 
+ {{{
+ [couchdb]
+ database_dir = c:/data/couch
+ view_index_dir = c:/data/couch
+ util_driver_dir = C:/Program Files/erl5.7.1/lib/apache-couchdb-0.9.0/priv
+ ConsoleStartupMsg=Apache CouchDB is starting.
+ max_document_size = 4294967296 ; 4 GB
+ max_attachment_chunk_size = 4294967296 ; 4GB
+ os_process_timeout = 5000 ; 5 seconds. for view and external servers.
+ max_dbs_open = 100
+ 
+ [httpd]
+ port = 5984
+ bind_address = 127.0.0.1
+ authentication_handler = {couch_httpd, default_authentication_handler}
+ WWW-Authenticate = Basic realm="administrator"
+ 
+ [log]
+ file = c:/logs/couch.log
+ level = info
+ 
+ [daemons]
+ view_manager={couch_view, start_link, []}
+ external_manager={couch_external_manager, start_link, []}
+ db_update_notifier={couch_db_update_notifier_sup, start_link, []}
+ query_servers={couch_query_servers, start_link, []}
+ httpd={couch_httpd, start_link, []}
+ stats_aggregator={couch_stats_aggregator, start, []}
+ stats_collector={couch_stats_collector, start, []}
+ 
+ [httpd_global_handlers]
+ / = {couch_httpd_misc_handlers, handle_welcome_req, <<"Welcome">>}
+ favicon.ico = {couch_httpd_misc_handlers, handle_favicon_req, "C:/Program Files/erl5.7.1/lib/apache-couchdb-0.9.0/share/www"}
+ 
+ _utils = {couch_httpd_misc_handlers, handle_utils_dir_req, "C:/Program Files/erl5.7.1/lib/apache-couchdb-0.9.0/share/www"}
+ _all_dbs = {couch_httpd_misc_handlers, handle_all_dbs_req}
+ _active_tasks = {couch_httpd_misc_handlers, handle_task_status_req}
+ _config = {couch_httpd_misc_handlers, handle_config_req}
+ _replicate = {couch_httpd_misc_handlers, handle_replicate_req}
+ _uuids = {couch_httpd_misc_handlers, handle_uuids_req}
+ _restart = {couch_httpd_misc_handlers, handle_restart_req}
+ _stats = {couch_httpd_stats_handlers, handle_stats_req}
+ 
+ [httpd_db_handlers]
+ _design = {couch_httpd_db, handle_design_req}
+ _temp_view = {couch_httpd_view, handle_temp_view_req}
+ 
+ [httpd_design_handlers]
+ _view = {couch_httpd_view, handle_view_req}
+ _show = {couch_httpd_show, handle_doc_show_req}
+ _list = {couch_httpd_show, handle_view_list_req}
+ 
+ }}}
+ 
+ Make sure that the `database_dir` exists and that the `LogFile` can be created.
+ 
+ == Running ==
+ 
+ Launch `erl` (or `werl`) and execute the following command:
+ 
+ {{{
+ couch_server:start().
+ }}}
+ 
+ 
+ If you encounter any trouble, set the [log] 'level' to 'debug' in local.ini
+ 
+ To check that everything has worked point Firefox web browser to
+ [[http://127.0.0.1:5984/_utils/index.html]] and run the test suite.
+ 

Mime
View raw message