Thursday, March 19, 2009

Yak Shaving is the new Dependency Hell

‹prev | My Chain | next›

Important Note: to run CouchDB 0.9, you must have the erlang emulator 5.6 or higher installed (erlang 12.b.3 that comes with Ubuntu 8.10 / Intrepid will work). To see which version of the emulator you are running, issue the following at the command prompt:erl +V

One of the requirements for EEE Cooks is full text searching. So, for my chain tonight, I wanted to give couchdb-lucene a try. Since it only works on 0.9 (latest trunk), I need to do a bit of yak shaving.

The install of couchdb-lucene is straight-forward. On my Ubuntu system, all that was needed was:
sudo apt-get install maven2
git clone git://
cd couchdb-lucene/
Installing couchdb from subversion incurred a thin slice of dependency hell. After checking it out and bootstrapping:
svn co couchdb
cd couchdb
I give configuration a try only to hit this:
checking for icu-config... no
*** The icu-config script could not be found. Make sure it is
*** in your path, and that taglib is properly installed.
*** Or see
configure: error: Library requirements (ICU) not met.
On Ubuntu, this is resolved with
cstrom@jaynestown:~/repos/couchdb$ sudo apt-get install libicu-dev
But then I get:
checking for curl-config... no
*** The curl-config script could not be found. Make sure it is
*** in your path, and that curl is properly installed.
*** Or see
configure: error: Library requirements (curl) not met.
Man, I hope this doesn't take too long. Resolve this dependency with:
cstrom@jaynestown:~/repos/couchdb$ sudo apt-get install libcurl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libcurl-dev is a virtual package provided by:
libcurl4-openssl-dev 7.18.2-1ubuntu4.3
libcurl4-gnutls-dev 7.18.2-1ubuntu4.3
You should explicitly select one to install.
Great. Not looking good. Well, I'll pick one. let's say the gnutls one:
cstrom@jaynestown:~/repos/couchdb$ sudo apt-get install libcurl4-gnutls-dev
Have I reached my yak yet?
checking for erl... /usr/bin/erl
checking for erlc... /usr/bin/erlc
checking erl_driver.h usability... no
checking erl_driver.h presence... no
checking for erl_driver.h... no
configure: error: Could not find the `erl_driver.h' header.

Are the Erlang headers installed? Use the `--with-erlang' option to specify the
path to the Erlang include directory.
Nope, have not quite reached the yak.
cstrom@jaynestown:~/repos/couchdb$ sudo apt-get install erlang-dev
Please let that be it:
You have configured Apache CouchDB, time to relax.

Run `make && make install' to install.
Woo hoo!

I am not one for running downloaded, unsigned code as root, so after making the code, run the local development mode to verify that it is functional:
make && ./utils/run 
Apache CouchDB 0.9.0a756286 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
Next up: full text indexing.


  1. Sigh. I got all the way to the last step and got:
    checking for erl... /usr/bin/erl
    configure: error: The installed Erlang version is less than 5.6.0 (R12B).


  2. Ouch. Sorry to hear these instructions didn't work for you. I will update the article to indicate that you need to be running at least Ubuntu 8.10 (Intrepid).

    Sounds like you have even more yak shaving than I did :(

  3. I finally got it shaved.

    * Built erlang R12B-5 from source (that was its own yak shaving adventure :-) )

    * Added ~/lib/erlang/bin to PATH

    * Used "--with-erlang" switch (e.g., ./configure --prefix=$HOME --with-erlang=/home/pubuntu/lib/erlang/erts-5.6.5/include

    et, voila:
    You have configured Apache CouchDB, time to relax.

    Run `make && make install' to install.

    Thanks for the blog. It got me most of the way there!

  4. First of all, I want to thank you so much for posting this. After spending hours trying to work through it, I found your post and I sped right through, up until the last part, where I encountered this error:

    Apache CouchDB 0.10.0a768140 (LogLevel=error) is starting.
    {"init terminating in do_boot",{{badmatch {error,shutdown}},[{couch_server_sup,start_server,1}, {erl_eval,do_apply,5},{erl_eval,exprs,5}, {init,start_it,1},{init,start_em,1}]}}

    Crash dump was written to: erl_crash.dump
    init terminating in do_boot ()

    Any ideas what it might be? Thanks ahead of time for your tremendous help!

  5. Any reason you need couchdb version 0.10? These instructions should work with 0.9, but I haven't had reason to try them with 0.10.

    Replace the svn checkout of couchdb with a download and `tar zxf apache-couchdb-0.9.0.tar.gz` of 0.9 from and this ought to work.

  6. Thanks for the help again. I just re-ran these steps with the 0.9 download and I'm still getting the same error! The errors are being written out to erl_crash.dump, but the file is all Greek to me.

  7. Sorry for the wild-goose chase. Seemed like the most obvious difference...

    You error look suspiciously like this one:

    Where did you unpack? How did run? I have the code in my own user's folder. I run with ./utils/run (*not* the couchdb command) from the directory in which I unpacked and built the code:

    cd ~/repos/couchdb

  8. I unpacked it in my home folder ~/apache-couchdb-0.9.0 then did './configure' and then 'make && ./utils/run'. I tried running as myself and with 'sudo ./utils/run' and had the same result. The permissions are 755 for '/usr/local/var/lib/couchdb' and '/usr/local/var/log/couchdb', so root should be able to write to them. I don't see any couchdb processes, so I don't think it's a problem with trying to bind with an in-use port. Any other ideas?

  9. I'm afraid I'm running out of ideas. You might try over on #couchdb on freenode.

    AFAIK when running ./utils/run, the only thing that needs to be writable is ~/apache-couchdb-0.9.0/couchdb/tmp/lib/ (where data is written).

    If anything is running on port 5984, this should show it:

    netstat -nlp | grep 5984

    Whenever I have something else running on 5984, I get the Mochiweb error as well (as described on the Error_messages page)

  10. Hi Again! It's all working now. I followed the steps on this blog post and everything worked fine.

    I created a couchdb user and ran couchdb with that user and everything seems to be just fine. Thanks for your help!

  11. CouchDB 0.9.0 and the correct version of Erlang are now in Ubuntu Karmic. You can now simply backport those 2 packages to Jaunty (using `apt-get source` and `apt-get build-dep`).