UPDATE: Since RethinkDB 1.4, this post is pretty irrelevant. You can now just do:
This will build RethinkDB without a hitch.
UPDATE: Check out Samuel Hughes’ comment on compiling in Slack, which may make some of the below process simpler. Specifically, the section about editing the Makefile to not use static libraries (apparently you can pass
RECOMMEND_STATIC=0 to the make process to do this instead).
So I’ve had a theoretical boner for RethinkDB ever since reading about it. I decided to try and give it a go, but have had problems compiling. I’m going to try and give an overview of how to get it running. These instructions are aimed at people who don’t have a linux with the targeted packaging systems that RethinkDB currently supports (in other words, you’re stuck with compiling it yourself). The build process is slightly annoying (which is why I’m writing this guide). Slava from the RethinkDB team told me that they are working on a new build system, so hopefully we’ll soon be able to just to a
See the instructions for building and installing V8. They are pretty simple, but I believe you need Python (since they use GYP for the build):
# do a manual installation
sudo mkdir -p /usr/local/v8/include /usr/local/v8/lib
sudo cp include/* /usr/local/v8/include
sudo cp out/native/lib.target/libv8.so /usr/local/v8/lib
Done (yeah, I know, my syntax highlighting is annoying).
This was a bit trickier, but hey I’ve compiled alpha versions of Compiz on top of Slack before, this should be a cakewalk. It took some Makefile tweaking to get it running, so here’s how I did it. Note that you’ll need Python >= 2.7 to do the full make process (or else you’ll get “AttributeError: ‘module’ object has no attribute ‘check_output’”). Slack 13.1 comes with 2.6.x so I had to compile it. Guess I need to upgrade soon. So grab the latest source:
git clone git://github.com/rethinkdb/rethinkdb.git
First things first,
src/Makefile adds the option
-Werror to the build. This is great, but causes the build to fail when it includes
v8.h since there are unused variables. So for now, we’ll have to trust them that there are no other warnings/errors and remove this from the Makefile. So open
src/Makefile in your favorite editor and change:
RT_CXXFLAGS+=-Wall -Wextra -Werror -Wnon-virtual-dtor
RT_CXXFLAGS+=-Wall -Wextra -Wnon-virtual-dtor
Also the Makefile tries to use static versions of some of the boost libs, but I only have dynamic versions on my system. So let’s comment out that line. Find this and comment it out (UPDATE: per Samuel Hughes’ comment below, you can skip this step and pass
RECOMMEND_STATIC=0 to the make commend instead of hacking up the Makefile):
Now let’s write a “simple” build script that wraps the make process:
export RT_CXXFLAGS="-I./include -I./src -I/usr/local/v8/include"
export RT_LDFLAGS="-L/usr/local/v8/lib ../support/usr/lib/libprotobuf.a ../support/usr/lib/libtcmalloc_minimal.a -lboost_program_options -lboost_serialization"
Save it to
compile.sh (or just
c like I do because life is just too short to be typing “ompile.sh” all over the place) and run it.
That should do it! If all the post-build stuff (like installing js modules and crap) works fine, you should be able to start the db like so:
If that’s too cumbersome for you, you can either link
/usr/local/lib or add
/usr/local/v8/lib to your
/etc/ld.so.conf file (and, of course, run
ldconfig as root) and run rethinkdb freely, without the worries of library paths.