What's this, then? The tlm project contains the make information for building Couchbase on multiple platforms.
Table of Contents
The file named CMakeLists.txt
contains the full build description
for Couchbase. It should be copied to the top of your source directory
(this happens automatically when you are using repo).
The cmake
directory contains macros used by cmake to configure a
build of Couchbase.
Makefile
is a convenience file that repo will put in the root of
your source directory. It invokes cmake
with a specific set of
options. "All" flavors of make should be able to parse this makefile,
and its defaults are set to match building on Microsoft Windows.
GNUmakefile
is another convenience file that repo will put in the
root of your source directory. GNU make will favor this file over
Makefile
and this file just overrides the defaults specified in
Makefile
.
It is recommended to perform "out of source builds". Running a build is simply:
trond@ok > mkdir source
trond@ok > mkdir build
trond@ok > cd source
trond@ok source> repo init -u git://github.com/couchbase/manifest -m branch-master.xml
trond@ok source> repo sync
trond@ok source> cd ../build
trond@ok build> cmake -D CMAKE_INSTALL_PREFIX=`pwd`/../install ../source
trond@ok build> gmake all install
The following steps is needed to build Couchbase on Microsoft Windows 2008R2
- Install OS, activate and run Windows Update and install all updates
- Install Google Chrome (optional, but makes your life easier)
- Install Visual Studio 2013 Professional
- Install all updates from microsoft update
- Install GIT and select the option to add GIT to path
- Install Python 2.7 and add c:\python27 to path (manually)
- Install 7-ZIP and add the installation to path (manually)
- Install CMake and add to path
- Install GO and add to path
- Download and install 2008 runtime extensions
- Create a directory named
c:\tools
and add it to your path.. Copyenvironment.bat
andrepo.exe
from the google drive folder into this directory (@todo figure out where to store them) - Copy the directory depot from google drive to
c:\
(endind up as:c:\depot
)
Repo will complain if git isn't properly configured. Setting name and email should be sufficient
C:\> git config --global user.email trond.norbye@gmail.com
C:\> git config --global user.name "Trond Norbye"
Unfortunately google repo don’t work that well on windows, so we have to use a hack provided by Volker. This procedure assume you want to build by using c:\compile\couchbase as the directory to hold the source:
C:\> mkdir C:\compile
C:\> mkdir C:\compile\couchbase
C:\> mkdir C:\compile\couchbase\.repo
C:\> cd C:\compile\couchbase\.repo
C:\compile\couchbase\.repo> git clone git://github.com/trondn/git-repo repo
C:\compile\couchbase\.repo> cd ..
C:\compile\couchbase> repo init -u git://github.com/couchbase/manifest -m branch-master.xml
C:\compile\couchbase> repo sync
Open cmd.com and type in the following (assuming c:\compile\couchbase is the directory holding your source):
C:\> set source_root=c:\compile\couchbase
C:\> set target_platform=amd64
C:\> environment
C:\compile\couchbase> nmake
And it should build the entire suite and install it into
c:\compile\couchbase\install
Multiple versions of Mac OSX may work, but this list is verified with Mavericks.
- Install XCode 5.1
- Install Homebrew
Install the following packages from homebrew:
trond@ok> brew install cmake erlang git icu4c libevent snappy v8
Ensure that your PATH
variable includes /usr/local/opt/icu4c/bin
:
trond@ok> export PATH=$PATH:/usr/local/bin:/usr/local/opt/icu4c/bin
You should be all set to start compile the server as described above.
The following chapters describes how to configure and build under various containers hosted by SmartOS. [Joyent][joyent_link] provides a variety of datasets for various operating systems (CentOS, Fedora, FreeBSD, Debian, SmartOS, ...). This section is not intended to cover all of these, but covers a set of configurations known to work.
The following descrtiption use the Centos-6 image imported by:
root@smartos~> imgadm import df81f45e-8f9f-11e3-a819-93fab527c81e
The KVM may be created with the following attributes (store in centos.json
):
{
"alias": "centos-6",
"brand": "kvm",
"resolvers": [
"10.0.0.1",
"8.8.4.4"
],
"default-gateway": "10.0.0.1",
"hostname": "centos",
"ram": "2048",
"vcpus": "2",
"nics": [
{
"nic_tag": "admin",
"ip": "10.0.0.201",
"netmask": "255.255.255.0",
"gateway": "10.0.0.1",
"model": "virtio",
"primary": true
}
],
"disks": [
{
"image_uuid": "325dbc5e-2b90-11e3-8a3e-bfdcb1582a8d",
"boot": true,
"model": "virtio",
"image_size": 10240
}
],
"customer_metadata": {
"root_authorized_keys": "ssh-rsa <my-personal-public-key>"
}
}
Create the KVM with:
root@smartos~> vmadm create -f centos.json
You should now be able to ssh into the machine and run yum update
and
install all of the updates ;-)
Install as much as possible of the precompiled dependencies with:
root@centos~> yum install -y libevent-devel libicu-devel \
snappy-devel gcc gcc-c++ libcurl-devel \
make ncurses-devel openssl-devel svn \
expat-devel perl-ExtUtils-CBuilder \
perl-ExtUtils-MakeMaker tcl gettext
Unfortunately the YUM repository don't include all (and new enough) versions of all we need, so you need to install the following from source:
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
wget https://gperftools.googlecode.com/files/gperftools-2.1.tar.gz
wget -Ov1.9.2.tar.gz https://github.com/git/git/archive/v1.9.2.tar.gz
wget --no-check-certificate -Ov8.tar.gz \
https://github.com/v8/v8/archive/3.19.0.tar.gz
wget http://www.erlang.org/download/otp_src_R16B03.tar.gz
gtar xfz cmake-2.8.12.1.tar.gz
gtar xfz libunwind-1.1.tar.gz
gtar xfz gperftools-2.1.tar.gz
gtar xfz v1.9.2.tar.gz
gtar xfz v8.tar.gz
gtar xfz otp_src_R16B03.tar.gz
cd git-1.9.2
gmake prefix=/usr install
cd ../cmake-2.8.12.1
./bootstrap && gmake all install
cd ../libunwind-1.1
./configure && gmake all install
cd ../gperftools-2.1
./configure && gmake all install
cd ../v8-3.19.0
gmake dependencies
gmake x64 library=shared -j 4
cp out/x64.release/lib.target/libv8.so /usr/local/lib
cp include/* /usr/local/include/
cd ../otp_src_R16B03
CFLAGS="-DOPENSSL_NO_EC=1" ./configure && gmake all install
cd ..
Install Google repo and you should be all set to start building the code as described above.
The following descrtiption use the Ubuntu image imported by:
root@smartos~> imgadm import d2ba0f30-bbe8-11e2-a9a2-6bc116856d85
The KVM may be created with the following attributes (store in ubuntu.json
):
{
"alias": "ubuntu",
"brand": "kvm",
"resolvers": [
"10.0.0.1",
"8.8.4.4"
],
"default-gateway": "10.0.0.1",
"hostname":"ubuntu",
"ram": "2048",
"vcpus": "2",
"nics": [
{
"nic_tag": "admin",
"ip": "10.0.0.202",
"netmask": "255.255.255.0",
"gateway": "10.0.0.1",
"model": "virtio",
"primary": true
}
],
"disks": [
{
"image_uuid": "d2ba0f30-bbe8-11e2-a9a2-6bc116856d85",
"boot": true,
"model": "virtio",
"image_size": 16384
}
],
"customer_metadata": {
"root_authorized_keys": "ssh-rsa <my-personal-public-key>"
}
}
Create the KVM with:
root@smartos~> vmadm create -f ubuntu.json
You should now be able to ssh into the machine and run aptitude
and
install all of the updates ;-)
Install as much as possible of the precompiled dependencies with:
root@ubuntu~> apt-get install -y git automake autoconf libtool clang \
clang++ libevent-dev libicu-dev \
libsnappy-dev libunwind7-dev erlang \
libv8-dev make ccache ibcurl4-openssl-dev
A newer version of cmake and google perftools is needed so we have to compile them from source with:
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
tar xfz cmake-2.8.12.1.tar.gz
cd cmake-2.8.12.1
./bootstrap && make && make install
cd ..
wget https://gperftools.googlecode.com/files/gperftools-2.1.tar.gz
tar xfz gperftools-2.1.tar.gz
cd gperftools-2.1
./configure && make && make install
Install Google repo and you should be all set to start building the code as described above.