building master

Geert Janssens geert.gnucash at kobaltwit.be
Sat Apr 22 08:40:56 EDT 2017


On vrijdag 21 april 2017 23:17:31 CEST Wm via gnucash-devel wrote:
> On 21/04/2017 19:21, John Ralls wrote:
> > Alex,
> > 
> > 
> > Looks like autotools picked the wrong compiler for a C++ object. See
> > http://stackoverflow.com/questions/6045809/link-error-undefined-reference
> > -to-gxx-personality-v0-and-g. Geert and I have both switched to cmake &
> > ninja-build; there's no issue there so it might be a typo in that
> > directory's Makefile.am.
> > 
> > On the other hand Geert just merged his C++ rewrite of
> > src/import-export/imp-csv, so if you have installed libs that are getting
> > linked in that could cause the error too.
> I've had intermittent difficulty with builds too recently but haven't
> said anything because I'm not building gnc for any particular purpose.
> 
What errors do you see Wm ?

> I have noticed the cmake / ninja combo has been mentioned more than one
> recently here.
> 
> Should others that build-because-we-do-it-anyway be switching and is
> there a suggested "start reading here" ref you could suggest?
> 
We have a wiki page on CMake [1]. It's been written quite some time ago, but it still looks like a 
good starting point. At that time ninja wasn't written yet so that information is currently missing.

In short cmake replaces automake/autoconf and the configuration script that's generated by 
those. It will produce build recipes for different build systems. The wiki page explains how to 
make these recipes for the gnu-make build system (which is the only build system supported by 
automake/autoconf by the way). So using cmake like this will generate Makefile files which can 
be used just like before by running make, make install, make check,...

Ninja on the other hand is an alternative for gnu-make with a strong focus on parallellizing the 
build as much as possible, and as such utilizing your typical multi-core cpu much more 
efficiently. The commands to use it are similar to gnu-make:
make -> ninja (or ninja-build)
make install -> ninja (or ninja-build) install
make check -> ninja (or ninja-build) check

I'm writing "ninja (or ninja-build)" because the name of the command depends on your OS. On 
Windows it's "ninja", on Fedora it's "ninja-build". Oh, well...

To instruct cmake to set up for ninja instead of gnu-make, you invoke cmake with "-G Ninja" 
added to the options. As an example my current cmake command looks like this:
cmake -D WITH_PYTHON=ON \
 -D CMAKE_INSTALL_PREFIX=<install-dir> \
 -DCMAKE_BUILD_TYPE=Debug -DWITH_AQBANKING=ON -G Ninja \
 <path-to-source-directory>



After that short intro, a few words on where to go next: because of the better performance and 
greater flexibility in build system support (even Ms Visual Studio is supported by cmake), we are 
seriously considering to switch to cmake in favor of autotools at some point.

We won't do so for the stable 2.6 series (although even that builds fine with cmake/ninja 
already; the combo is in active use for our Windows nightly builds). For the upcoming 2.8 
though it's very likely we will formally switch to cmake. There are a few release related details 
which still need to be ported to cmake before that switch can be complete though.

So for now we're formally supporting autotools/gnu-make and informally cmake/<whatever> in 
which John and I currently prefer <whatever> to be ninja for its performance.

> I'm building on Ubuntu LTS if it matters ... and it shouldn't really
> matter as I'm just building to keep in touch.

You didn't mention which LTS edition. However on my 14.04LTS ninja is already available, so I 
expect it to be in 16.04 as well.

Regards,

Geert

[1] http://wiki.gnucash.org/wiki/CMake


More information about the gnucash-devel mailing list