Overview
The build works like this:
We start by running
./autogen.shautogen.shrunsautoconfto turnconfigure.acintoconfigureautogen.shalso runsautomaketo turnMakefile.amintoMakefile.inandsrc/Makefile.amintosrc/Makefile.in
We then run
./configureconfigureturnsMakefile.inintoMakefileandsrc/Makefile.inintosrc/Makefileconfigurealso turnsconfig.h.inintoconfig.hthat contains some variablesconfigurealso writesconfig.log, if there are errors they will be there
ALWAYS run
./autogen.shand./configurefrom top-level, never a subdirectoryALWAYS configure with
--enable-ccachefor cachingALWAYS configure with
--enable-sdfprefsto inhibit noisy build outputNEVER edit
configuredirectly, only ever editconfigure.acNEVER edit
MakefileorMakefile.indirectly, only ever editMakefile.am
To change configuration settings, re-run ./configure with new flags.
You can see the existing configuration flags by looking at the head of config.log
Configuration variables
To change compiler from clang to gcc, switch the value you pass for CC and CXX.
For example run CXX=g++ CC=gcc ./configure ... to configure with gcc. We want
builds to always work with gcc and clang.
To alter compile flags (say turn on or off optimization, or debuginfo) change
CXXFLAGS. For example run CXXFLAGS='-O0 -g' ./configure ... to build
non-optimized and with debuginfo. Normally you should not have to change these.
Sometimes you will need to change to a different implementation of the C++
standard library. To do this, pass -stdlib=libc++ or -stdlib=libstdc++
in CXXFLAGS explicitly. But again, normally you don't need to do this.
Configuration flags
Here are some common configuration flags you might want to change:
--disable-teststurns offBUILD_TESTS, which excludes unit tests and all test-support infrastructure from core. We want this build variant to work since it is the one we ship, but it is uncommon when doing development.--disable-postgresturns off postgresql backend support in core, leaving only sqlite. tests will run faster, and also this is a configuration we want to work (we will remove postgres entirely someday).
There are also some flags that turn on compile-time instrumentation for different sorts of testing. Turn these on if doing specific diagnostic tests, and/or to check for "anything breaking by accident". If you turn any on, you will need to do a clean build -- the object files will have the wrong content.
--enable-asanturns on address sanitizer.--enable-threadsanitizersame, but for thread sanitizer.--enable-memchecksame, but for memcheck.--enable-undefinedchecksame, but for undefined-behaviour sanitizer.--enable-extrachecksturns on C++ stdlib debugging, slows things down.--enable-fuzzbuilds core with fuzz instrumentation, plus fuzz targets.
There is more you can learn by reading configure.ac directly but the
instructions above ought to suffice for 99% of tasks. Try not to do anything
too strange with the configuration.
When in doubt, or if things get stuck, you can always re-run ./autogen.sh
and ./configure.