In this blog post I'll show you how easy it is to get everything up'n'running using Windows 7 and Microsoft Visual Studio 2010. In addition to that you need to download and install git to be able to check out the source code (select the option that you want to put git in the path (not the full msys suite, but just git)).
I have to admit that I am far from a "hardcore Windows developer", so there is a lot of things I don't know about the platform. For instance I don't know where I should install third party header files and libraries, so I just decided that I'm going to install all of them into C:\local (with an install, lib and bin directory). I'd be happy if someone could tell me how I'm supposed to do this ;-)
So let's open up the Visual Studio Command Prompt and start building everything:
Setting environment for using Microsoft Visual Studio 2010 x86 tools. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC> cd %HOMEPATH% C:\Users\Trond> mkdir build C:\Users\Trond> cd build
Since we're going to build dll's you need to set C:\local\bin into your path so that the runtime linker finds the dll's:
C:\Users\Trond\build> set PATH=c:\local\bin;%PATH%
We need to install two dependencies before we can compile libcouchbase itself. Let's check out all of the source code we're going to use:
C:\Users\Trond\build> git clone git://github.com/membase/libisasl.git C:\Users\Trond\build> git clone git://github.com/membase/libvbucket.git C:\Users\Trond\build> git clone git://github.com/couchbase/libcouchbase.git C:\Users\Trond\build> git clone git://github.com/membase/memcached.git C:\Users\Trond\build> git clone git://github.com/trondn/vacuum.git
The first dependency we're going to build is the SASL library. This is the library libcouchbase use for authenticating to the Couchbase servers. To build and install the library, simply execute:
C:\Users\Trond\build> cd libisasl C:\Users\Trond Norbye\build\libisasl> nmake -f NMakefile install
That will install libisasl with its header files and libraries into c:\local.
The next library we need to build is libvbucket; the library libcouchbase use to figure out where a a vbucket is located (if you don't know what a vbucket is, you don't really need to know). It is just as easy as libvbucket to build:
C:\Users\Trond\build\libisasl> cd ..\libvbucket C:\Users\Trond\build\libvbucket> nmake -f NMakefile install
The next thing we need to do is to install some headerfiles libcouchbase needs during build time. These header files contains the protocol definitions libcouchbase needs (but it is not needed by the application). So let's go ahead and install them (to make it easier for us to build libcouchbase)
C:\Users\Trond\build\libvbucket> cd ..\memcached C:\Users\Trond\build\memcached> git checkout -b branch-20 origin/branch-20 C:\Users\Trond\build\memcached> mkdir c:\local\include\memcached C:\Users\Trond\build\memcached> copy include\memcached c:\local\include\memcached
So let's go ahead and build libcouchbase!
C:\Users\Trond\build\memcached> cd ..\libcouchbase C:\Users\Trond\build\libcouchbase> nmake -f NMakefile install
I guess that most Windows developers don't use nmake during their development, but use the full IDE instead. That's why I've created a project you may open in the vacuum project. So feel free to open that project now, and it should build without any problems.
Now we're going to need a Couchbase server we can connect to. If you don't have any running, you should download and install one now.
Let's go ahead and create the spool directory and start the vacuum server...
C:\Users\Trond\build\vacuum\Debug> mkdir c:\vacuum C:\Users\Trond\build\vacuum\Debug> vacuum -h 127.0.0.1:8091
And you can start copy JSON files into C:\vacuum and see them being added to the Couchbase cluster!
Hi Trond,
ReplyDeleteThank you for all these details.
I was looking for this exact info at the web :), since couchbase didn't provide a smooth procedure for it.
I still have one question to you:
How did you manage to link the 'vacuum' project ?
VS 2010 refuses to link with the other libs that
were compiled through nmake and
complains about the '__imp__lcb_enable_timings' missing symbol (and on some other from the same format).
Please advice.
Thanks again,
Erez
Hi,
ReplyDeleteI replaced my box running visual studio 2010 with 2008 so I wasn't able to open the project anymore, but I applied a patch that adds an nmakefile to build it from the command line. With that I was able to link the problem without any problems.
I checked out the latest bits of libcouchbase and vacuum with:
git clone git://github.com/couchbase/libcouchbase
git clone git://github.com/trondn/vacuum
before I did "nmake -f NMakefile install" in libcouchbase (which installs all of the files in a folder named "deps" next to the two checkouts. In vacuum you should now be able to run: nmake -f NMakefile
Hope this helps
Thanks you !
ReplyDeleteI have already created one project that builds a standalone project without any libs.
By the way, have you found a "C" API to lock a CLUSTER/BUCKET ?
Thanks again,
Erez
What do you mean by lock a cluster/bucket?
ReplyDeleteDuring this website, you will see this shape, i highly recommend you learn this review. https://onohosting.com/
ReplyDelete