ArangoDB on Raspberry Pi: Explore Possibilities | ArangoDB ’13
During the ArangoDB Hackathon weekend, we tried to compile ArangoDB on a Raspberry PI using Raspbian as operating system.
ArangoDB needs some external libraries in order to compile
- libev
- ICU
- V8
- zlib
Libev, ICU and zlib compiled without problems. Raspbian comes with a precompiled version of V8 – but it’s too old for ArangoDB. So, we had to compile V8 ourself. A single make run takes hours and hours to complete. Using the default parameters it complains about wrong flags for the hard-float ABI. After some googling and endless hours of waiting for the compile to complete, we found a set of flags that finally worked.
- you need to pass the options -march=armv6 to the compiler and linker
- you need to disable CAN_USE_VFP3_INSTRUCTIONS
- use -O2 instead of -O3 (I’m not sure if this is necessary or not)
If you downloaded ArangoDB 1.3, use the following diff to patch the Google V8 Makesystem
index 3a59639..7bb9cab 100644 --- a/3rdParty/V8/build/common.gypi +++ b/3rdParty/V8/build/common.gypi @@ -146,6 +146,14 @@ 'CAN_USE_ARMV7_INSTRUCTIONS=1', ], }], + ['armv7==0', { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': ['-march=armv6',], + 'ldflags': ['-march=armv6',], + }], + ], + }], [ 'v8_can_use_unaligned_accesses=="true"', { 'defines': [ 'CAN_USE_UNALIGNED_ACCESSES=1', @@ -167,7 +175,7 @@ [ 'v8_can_use_vfp3_instructions=="true" or arm_neon==1 or \ arm_fpu=="vfpv3" or arm_fpu=="vfpv3-d16"', { 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', + # 'CAN_USE_VFP3_INSTRUCTIONS', ], }], [ 'v8_use_arm_eabi_hardfloat=="true"', { @@ -414,13 +422,13 @@ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="android"', { 'cflags!': [ - '-O2', + '-O3', '-Os', ], 'cflags': [ '-fdata-sections', '-ffunction-sections', - '-O3', + '-O2', ], 'conditions': [ [ 'gcc_version==44 and clang==0', {
Switch into the 3rdParty/V8 directory and execute
GYP_DEFINES="armv7=0" make library=static strictaliasing=off snapshot=off werror=no hardfp=on arm.release
This will produce the libraries and the shell example. Try the shell to verify that everything worked
pi@raspberrypi ~/ArangoDB/3rdParty/V8 $ ./out/arm.release/shell V8 version 3.16.14.1 [sample shell] >
The ArangoDB Makefile does not know about ARM, so we need to fake it. Go into the out
directory and execute
pi@raspberrypi ~/ArangoDB/3rdParty/V8 $ cd out pi@raspberrypi ~/ArangoDB/3rdParty/V8/out $ ln -s arm.release ia32.release
There is one open problem: atomic compare and swap. It is currently not used in the production code of 1.3 AFAIK, so I’ve commented it out.
index 498bf70..1a45887 100644 --- a/lib/BasicsC/locks-posix.c +++ b/lib/BasicsC/locks-posix.c @@ -592,7 +592,8 @@ bool TRI_CompareAndSwapIntegerInt64 (volatile int64_t* theValue, int64_t oldValu #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 return OSAtomicCompareAndSwap64(oldValue, newValue, theValue); #elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 - return __sync_val_compare_and_swap(theValue, oldValue, newValue); + // FIXME return __sync_val_compare_and_swap(theValue, oldValue, newValue); + return 0; #else #error No TRI_CompareAndSwapIntegerInt64 implementation defined #endif @@ -602,7 +603,8 @@ bool TRI_CompareAndSwapIntegerUInt64 (volatile uint64_t* theValue, uint64_t oldV #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 return OSAtomicCompareAndSwap64((int64_t)(oldValue), (int64_t)(newValue), (volatile int64_t*)(theValue)); #elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 - return __sync_val_compare_and_swap(theValue, oldValue, newValue); + // FIXME return __sync_val_compare_and_swap(theValue, oldValue, newValue); + return 0; #else #error No TRI_CompareAndSwapIntegerUInt64 implementation defined #endif
Now we are ready to compile:
pi@raspberrypi ~/ArangoDB $ touch .v8-build-32 pi@raspberrypi ~/ArangoDB $ ./configure --enable-all-in-one-icu --enable-all-in-one-v8 CPPFLAGS="-DUSE_EABI_HARDFLOAT -march=armv6 -mfloat-abi=hard" pi@raspberrypi ~/ArangoDB $ make
This produced executables. Start the server
pi@raspberrypi ~/ArangoDB $ mkdir /tmp/testbase pi@raspberrypi ~/ArangoDB $ ./bin/arangod -c etc/relative/arangod.conf /tmp/testbase 2013-07-29T09:41:42Z [28103] INFO ArangoDB 1.3.1 -- ICU 49.1.2, V8 version 3.16.14.1, SSL engine OpenSSL 1.0.1e 11 Feb 2013 2013-07-29T09:41:42Z [28103] INFO using default language 'en' 2013-07-29T09:41:42Z [28103] INFO using endpoint 'tcp://localhost:8529' for http non-encrypted requests 2013-07-29T09:41:42Z [28103] INFO JavaScript using startup './js', modules './js/server/modules;./js/common/modules;./js/node', packages './js/npm', actions './js/actions', application './js/apps' 2013-07-29T09:41:53Z [28103] INFO Authentication is turned off 2013-07-29T09:41:54Z [28103] INFO ArangoDB (version 1.3.1) is ready for business. Have fun!
Next start the shell
pi@raspberrypi ~/ArangoDB $ ./bin/arangosh -c etc/relative/arangosh.conf Please specify a password: _ __ _ _ __ __ _ _ __ __ _ ___ ___| |__ / _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \ | (_| | | | (_| | | | | (_| | (_) \__ \ | | | \__,_|_| \__,_|_| |_|\__, |\___/|___/_| |_| |___/ Welcome to arangosh 1.3.1. Copyright (c) triAGENS GmbH Using Google V8 3.16.14 JavaScript engine, READLINE 6.2, ICU 49.1.2 Connected to ArangoDB 'tcp://127.0.0.1:8529' version 1.3.1 ------------------------------------- Help ------------------------------------- Predefined objects: arango: ArangoConnection db: ArangoDatabase Example: > db._collections(); list all collections > db.<coll_name>.all().toArray(); list all documents > id = db.<coll_name>.save({ ... }); save a document > db.<coll_name>.remove(<_id>); delete a document > db.<coll_name>.document(<_id>); get a document > db.<coll_name>.replace(<_id>, {...}); overwrite a document > db.<coll_name>.update(<_id>, {...}); partially update a document > help show help pages > exit Note: collection names may be cached in arangosh. To refresh them, issue: > db._collections();
And enjoy! I’ve not done many tests, actually only one: save and restore documents. So, I’ve no idea how stable it is.
8 Comments
Leave a Comment
Get the latest tutorials, blog posts and news:
Hello,
It would be very helpfull if you could detail the steps in a more tutorial way kind of, like type sudo apt-get somelibrary, then type wget http://www.where.google.hides.his.v8 , etc
I’m looking to use ArangoDB on small mostly single user Node.JS applications that I want to run on the Raspberry Pi.
1.4.0-beta2 will be released in the next days. I will try to produce a more detail tutorial with the new version.
I saw that 1.4 is now released, is this story (now apparently edited) still true ?
it would be awesome to just “apt-get” the binaries for the Raspberry Pi, but I guess this is possible to do too… it’s more verbose than before, so I guess it might work.
I’ll try tomorrownight…
In order to get it up and running, you now can do
git clone
configure
make install
I also manage to create a deb package, which installs. But there is a bug in the setup script – I assume. I’m still debugging.
SUPER !
Danke schoen !
Hello,
I am wondering if you or anybody else tried to compile the last version (3.6.0) on the new Raspberry Pi 4 which provides better hardware. I would like to try to run a small ArangoDB cluster on 3 or more Raspberry Pi 4 for testing and development. Any help or suggestion is highly appreciated.
Thank you.
Hi there,
we do not support ARM with ArangoDB. We would love to but just don’t have the resources to design, test and maintain a package for ARM atm. Maybe there is some community effort to get this rollin but the internal team does not have plans for a package for the near future.
I have compiled arangodb for ARM64V8 architectures, people can run arm version of arangodb by using this docker image. Note: It doesnt support official endpoint yet.
Command: docker run -p 8529:8529 omert08/arangodb-arm64:3.4.10
Github: https://github.com/omert08/arangodb-arm64
Docker Image: https://hub.docker.com/r/omert08/arangodb-arm64