Building RethinkDB in Arch Linux

by Paweł Świątkowski
05 Oct 2015
This is a note-to-self-style post for the process I went through and don't want to forget. It should be improved by RethinkDB itself, probably.

Last weekend I finally managed to build the edge version of RethinkDB on my Arch Linux-based laptop. Although the whole process is described on RethinkDB’s pages, it’s not actually quite so easy as they say it is. So here’s the walkthrough.

First of all, there seems too be a problem with npm. This is not any surprise per se but I got really stuck on this step in the past. To be precise, --no-registry flag that RethinkDB uses does exactly the opposite than the name suggets and when you use it, you actually have to pass some repository URL, or it will fail. So first step is to go to mk/support/pkg/npm-pkg.inc and remove it from line:

in_dir "$install_dir" npm --no-registry install "$pkg"

Now, after running ./configure --allow-fetch, go to config.mk in root directory of the project and set proper Python interpreter (to Python 2):

PYTHON := /usr/bin/python2

The above step may be skipped and you can use the solution that RethinkDB devs suggest (put a script in /usr/local/bin/python), but be warned that the script they give is not working ;) I already submitted a pull request fixing it, but I don’t like this solution anyway (feels dirty) and that’s why I prefer method described above.

But unfortunately it’s not enough. V8’s install script does not care about such things as Python versions and even though you set the path to python2, it’s gonna use your original /usr/bin/python (which should be 3, we’re in the 21st century). To work around that, I used a trick from V8’s PKGBUILD. So, go to external/v8_3.30.33.16 (or whichever version is there in the tree) and execute these two handy commands:

find build/ test/ tools/ src/ -type f -exec \
  sed -e 's_^#!/usr/bin/env python$_&2_' \
      -e 's_^#!/usr/bin/python$_&2_' \
      -e "s_'python'_'python2'_" -i {} \;

sed 's/\bpython\b/python2/' -i Makefile build/gyp/gyp

After that, it should be good to go to the project’s root, type make and have RethinkDB compiled and ready to hack on it. Happy coding!

end of the article

Tags: rethinkdb archlinux

This article was written by me – Paweł Świątkowski – on 05 Oct 2015. I'm on Fediverse (Ruby-flavoured account, Elixir-flavoured account) and also kinda on Twitter. Let's talk.

Related posts: