[build2] Using build2 on a project with lots of dependencies

Boris Kolpackov boris at codesynthesis.com
Fri Dec 22 09:35:35 UTC 2017


Philippe Payant <philtherobot at gmail.com> writes:

> I understand that build2's take is that dependencies should be source, not
> binary.  You have your project, and the dependencies are installed as
> packages, which implies that all the dependencies are built with build2.
> Did I get this right so far?

Yes, except that we do support system-installed packages both at the
build system level (searching for libraries in the compiler's library
search paths, pkg-config, etc) as well as at the package manager level
(via stub packages and the sys: package scheme).


> There are great reasons to depending on sources and compiling them
> according to the correct configuration - no problem here.

Right. I would even use the word "exact" rather than "correct":
everything is compiled in exactly the same configuration as your
project.


> My project depends around 20 libraries and... on Qt.  Obviously, right
> there, compiling Qt on each configuration is a no-go, and Qt does not build
> with build2.

build2 is a forward-looking project, our aim is to do thing correctly,
not to make things work "for now". You are saying that building Qt from
source is a no-go. Why is that? Well, to start, it is a bloated, fairly
monolithic library that tries to do all things for all people. If it were
to be split into individual components, then you could have depended only
on what you actually use.

There is also the other side of the medal: C++ compilation is slow. There
is, however, progress in this area. C++ modules are on the horizon (our
preliminary tests showed 3x compile time speedup is achievable). In build2
we are also all set to provide generally-available distributed compilation.

So if/when Qt got modularized (split up into individual components and
converted to C++ modules) and 16+ core machines become fairly ubiquitous
(probably will happen in a few years), building Qt from source might not
be such a crazy idea.


> In any case, what I would like is to setup things such that all those
> dependencies are prebuilt and shared amongst my configurations. I am ready
> to run the risk of a configuration/library mismatch and manage this
> myself.  I get reduced disk usage and faster compilation times in
> exchange.  The build2 configuration directory is hackable, so maybe there
> is a possibility through there.

Yes, you can do all of this with system-installed packages. And by "system"
here I don't mean it has to come from the underlying distribution's package
manager (dpkg, rmp, etc) -- anything that you install manually and can
provide -I/-L options for (if necessary) will work.

Boris



More information about the users mailing list