We have spent a lot of time working on ArangoDB 3.0. That version will not only provide major functionality and performance improvements, but will also come with an improved, CMake-based build system.
This post explains how to use CMake to build ArangoDB 3.0 on a recent Ubuntu Linux. For the impatient there’s a command summary at the end of this post.
Installing prerequisites
Here’s how to build ArangoDB 3.0 with cmake on a recent Ubuntu Linux.
Ubuntu 15.x and 16.x should have recent enough packages so any missing
prerequisites can be installed via a simple sudo apt-get install
command:
1
|
|
Older versions of Ubuntu can be convinced to work too, but this requires a g++ version of at least 4.9. Ubuntu 14 ships with older g++ versions by default, so you will first need to install a newer g++ version (see here or here for some external instructions). Once the g++ and gcc compilers are recent enough, install the other prerequisites.
Cloning ArangoDB
After having installed the prerequisites, clone the ArangoDB repository
from Github and then cd into the directory arangodb
that the cloning
will have created:
1 2 |
|
Then check out the 3.0 branch and pull the latest changes:
1 2 |
|
Building ArangoDB
A convention when using CMake is to not build directly in the source directory, but use a separate build directory instead. The benefit of this is that building in a separate directory won’t change the source directory, and the build directory can be disposed easily.
To create an initial build directory named build
and cd into it,
just type:
1 2 |
|
It’s now time to invoke CMake. CMake should be executed from the build
directory, but needs to know where it’s build instructions file
(named CMakeLists.txt
is). This file is located in the source directory.
To run CMake without any specific options, we can use:
1
|
|
This will run CMake from inside the build
directory and tell it to
look for CMakeLists.txt
in the source directory. The
-DCMAKE_BUILD_TYPE=RelWithDebInfo
part will tell CMake to build
binaries with optimizations and debug symbols. Other useful build
types are:
-DCMAKE_BUILD_TYPE=Debug
: without optimizations, for debugging only-DCMAKE_BUILD_TYPE=Release
: with optimizations, no debug symbols, not useful for debugging
Invoking CMake will perform some checks for required components, compiler
and platform features. If anything fails, it should print some error
message. If everything works well, the command should have created a
Makefile
in the build
directory.
side note: CMake on Linux will by default generate UNIX Makefile
s,
but it can also be told to generate ninja
files instead. On Windows it can generate solution files for Visual
Studio.
Now that the Makefile
is there, we can run make
as usual (note that
the -j4
means to build with 4 parallel processes – adjust as needed!):
1
|
|
Starting arangod and arangosh
And that’s already it for a normal build. Note that the build artefacts
and thus the binaries will also be created inside the build
directory.
arangod
and arangosh
will be located in the bin
subdirectory of
the build
directory. There is no need to install these binaries, they
can be run without installing them first. However, starting them from
inside the build directory will not work, because they will complain
about missing files. It is better to cd one level up first and then
start them:
1 2 |
|
The former will start arangod with default configuration, with a fresh
database directory located in ~/testdata
.
If you ran all the commands on your local machine (127.0.0.1) then you can now open a browser and point it to http://127.0.0.1:8529/. This should bring up ArangoDB’s web interface.
You can alternatively start an ArangoShell to connect to the ArangoDB
server. In another terminal window, cd into the arangodb
directory and
start an ArangoShell as follows:
1 2 |
|
You should now see the ArangoShell prompt and be able to type some commands!
Command summary
Note: in contrast to the above step-by-step instructions, some commands here have been put together on a single line to make developer’s life easier.
1
|
|
1 2 3 4 5 6 |
|
1 2 3 |
|