You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2011/05/04 16:53:33 UTC

[Couchdb Wiki] Trivial Update of "Building_from_source_on_Windows" by DaveCottlehuber

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.
The comment on this change is: part 1 of 3 riveting episodes.
http://wiki.apache.org/couchdb/Building_from_source_on_Windows

--------------------------------------------------

New page:
<<TableOfContents>>

= Overview =

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
correctly to compile Erlang/OTP from source, so that the subsequent Erlang and
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

In most cases you will not want to do this and should use the
[[Windows_binary_installer]] instead.

= Toolchain =

open control panel, and set new environment variables:

{{{
CYGWIN="nontsec nodosfilewarning"
RELAX=c:\relax
}}}

%RELAX% will be used later on for stashing files; use any sane location without spaces or special characters.

Then download these, and then install in sequence:

 * 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

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

Download & keep these handy in %relax%\bits or similar:

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

 * 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.

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

}}}