With g++ 6 becoming more and more adopted, it’s about time to point out an issue that hit some of us ArangoDB developers and a few of our users that compile ArangoDB from source with g++ 6.
The problem is that when compiling ArangoDB with g++6 with default options, arangod starts and almost immediately segfaults.
- node.js: https://github.com/nodejs/node/issues/6724
- chromium: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68853
The reason for the error now popping up is a change in the g++ 6 optimizer as stated in the gcc6 release notes:
Value range propagation now assumes that the this pointer of C++ member functions is non-null. This eliminates common null pointer checks but also breaks some non-conforming code-bases (such as Qt-5, Chromium, KDevelop). As a temporary work-around -fno-delete-null-pointer-checks can be used. Wrong code can be identified by using -fsanitize=undefined.
That means if compiling ArangoDB 2.8 from source with g++ 6 or higher, please be sure to
set the environment variables
CXXFLAGS="-fno-delete-null-pointer-checks" before invoking the
1 2 3
The options will then be passed to the sub-make that builds the V8 engine. If you have
already built V8 without these options, try removing the file
.v8-build-64 from the
build directory and run
As a reminder, ArangoDB 2.8 will also emit this big notice at the end of its
1 2 3 4 5 6 7 8 9
Users of g++ 5.x do not need to set these flags, neither need users of clang++. And in the ArangoDB 3.0 build the options will be set automatically when compiling V8 if the compiler is g++. They will not be set for compiling any other parts of ArangoDB as it’s only required for building V8.