Pages

Monday, 2 June 2014

Compile or install RethinkDB on the Cubietruck

Introduction

For one of the projects I’m currently working on, I needed a NoSQL database that could run on a simple ARM SBC. Until the Cubietruck crossed my path I never considered doing these kinds of things since most SBCs use SD cards as storage. Adding my precious data to an unreliable SD card is just not something I could live with :)

This all changed when I recently bought a Cubietruck, this device not only offers a lot more performance, it also offers the option to hook up a SATA drive. With the ability to have a NoSQL database on an ARM SBC, my next step was to choose which database to use.

MongoDB was my first choice since I’m very familiar with that one. There’s only one problem, MongoDB’s codebase seems to contain x86 specific code, so a MongoDB ARM version seems not something you could easily build.

My second choice was CouchDB. However, while searching for some extra info about it, I stumbled upon RethinkDB. A few articles later I decided to abandon my plans to use CouchDB and picked RethinkDB.

I haven’t regret my choice for a moment. The little help I needed in order to get the sources compiled, I easily got from the community. Both from their IRC channel as from their forum I immediately got the help I needed.

Install RethinkDB

In order to get this tutorial running I assume you’ve installed Ubuntu on the Cubietruck. You find an installation manual to Install Ubuntu on the Cubietruck here.

sudo apt-get install git g++ protobuf-compiler libprotobuf-dev libv8-dev libboost-dev curl build-essential nodejs npm

sudo vim /etc/fstab

Change the tmp storage to 128mb (the default of 20mb it too small for the compiler)

tmpfs            /tmp           tmpfs    size=128m 0       0

Get the sources and compile them

wget http://download.rethinkdb.com/dist/rethinkdb-latest.tgz
tar xvzf rethinkdb-latest.tgz
cd rethinkdb
./configure --without-tcmalloc --allow-fetch
make

if you get the following error:

gcc: error: unrecognized command line option "-m32"

change the following files:

  • ~/rethinkdb–1.12.5/external/v8_3.22.24.17/third_party/icu/source/aclocal.m4
    • CXXFLAGS=“${CXXFLAGS} -m32”, change to: CFLAGS=“${CFLAGS}”
    • CFLAGS=“${CFLAGS} -m32”, change to: CFLAGS=“${CFLAGS}”
  • ~/rethinkdb–1.12.5/external/v8_3.22.24.17/third_party/icu/source/configure:
    • CXXFLAGS=“${CXXFLAGS} -m32”, change to: CXXFLAGS=“${CXXFLAGS}”
    • CFLAGS=“${CFLAGS} -m32”, change to: CFLAGS=“${CFLAGS}”
  • ~/rethinkdb–1.12.5/external/v8_3.22.24.17/third_party/icu/icu.gyp:
    • ‘cflags’: [ ‘-m32’ ], change to: ‘cflags’: [ ’’ ]
    • ‘ldflags’: [ ‘-m32’ ], change to: ‘ldflags’: [ ’’ ]

For more info on this issue see also Yoeori/docs

The compiled archive is also available for download here.