Forum: Installation

Post: Can't build community edition with hardcoded CPPFLAGS in build.py

Can't build community edition with hardcoded CPPFLAGS in build.py
calcifer
Oct 20, 2015
I have to force gcc (using the sed line below) not to treat warnings as errors to build latest VoltDB community edition (5.7.1 as of today).

$ sed -i 's/-Werror//g' voltdb-voltdb-5.7.1/build.py


Without that, the build fails due to hundreds of strict aliasing warnings like the following:


[exec] ../../src/ee/storage/TupleBlock.h:70:54: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[exec]          return *reinterpret_cast<int32_t*>(valueBytes);
[exec]                                                       ^


This has only been happening since 5.6; it wasn't a problem with VoltDB 5.5. Seems like the warnings should be fixed on your end or at least you could remove the -Werror flag? Or even better, don't hardcode any CPPFLAGS and trust the environment to set the correct flags while providing sensible defaults.

gcc -v output:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc-multilib/src/gcc-5.2.0/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.2.0 (GCC) 
jhugg
Oct 20, 2015
Hi Calcifer,

This is a balance for us. We get a lot of value from strict warnings from our compiler, and have no intention of turning that off. Many of the warnings uncover really interesting issues, or at least force us to write more straightforward code.

The tradeoff is that new versions of GCC or Clang often require some tweaking to the build files or the code to make everything build smoothly. We actually have an internal build system that verifies clean builds on all tested platforms for each code check-in. I'm guessing you're running a newer distort than us. Mostly we test on Ubuntu 14.04 or Centos 6/7.

A quick workaround for you is to just to disable treating warnings as errors in our build.py file. Alternatively we accept patches or pull requests.

Could you tell us which disto and version you're running? We'll try to make it build smoother for a future release.
calcifer
Oct 20, 2015
I'm running this on latest Arch Linux, but I've tested with GCC 4.8 too. Maybe that's too new as well?

For a future release, can you at least check the CPPFLAGS environment variable and, if it's set, avoid using your hardcoded flags? That way your builds continue to work fine and people building on bleeding edge systems can provide their own flags.
jhugg
Oct 20, 2015
We'll think about it. We'd certainly consider a community-provided patch, too.
calcifer
Oct 20, 2015
Thanks. I'll see if I can send a pull request on Github.