Jemalloc

This article is only relevant if you intend to compile ArangoDB on Ubuntu 16.10or Debian testing

On more modern linux systems (development/floating at the time of this writing)you may get compile / link errors with ArangoDB regarding jemalloc.This is due to compilers switching their default behavior regarding thePIC - Position Independend Code. It seems common that jemalloc remains in astage where this change isn’t followed and causes ArangoDB to error out duringthe linking phase.

From now on cmake will detect this and give you this hint:

  1. the static system jemalloc isn't suitable! Recompile with the current compiler or disable using `-DCMAKE_CXX_FLAGS=-no-pie -DCMAKE_C_FLAGS=-no-pie`

Now you’ve got three choices.

  • Doing without jemalloc

Fixes the compilation issue, but you will get problems with the glibcs heapfragmentation behavior which in the longer run will lead to an everincreasing memory consumption of ArangoDB.

While this may be suitable for development / testing systems, its definitelynot for production.

  • Disabling PIC altogether

This will build an arangod which doesn’t use this compiler feature. It maybe not so nice for development builds. It can be achieved by specifyingthese options on cmake:

  1. -DCMAKE_CXX_FLAGS=-no-pie -DCMAKE_C_FLAGS=-no-pie
  • Recompile jemalloc

The smartest way is to fix the jemalloc libraries packages on your system soits reflecting that new behavior. On Debian / Ubuntu systems it can beachieved like this:

  1. apt-get install automake debhelper docbook-xsl xsltproc dpkg-dev
  2. apt source jemalloc
  3. cd jemalloc*
  4. dpkg-buildpackage
  5. cd ..
  6. dpkg -i *jemalloc*deb