Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2020-03-07 13:36:59


AMDG

On 3/6/20 10:41 PM, Rainer Deyke via Boost wrote:
> On 06.03.20 23:42, Vinnie Falco via Boost wrote:
>> I think Peter is right in this case. Library A which uses library B
>> should not have an opinion on whether library B is consumed as
>> header-only or as a linked library. The decision on how each library
>> in a linked executable is configured should be up to the top-level
>> build target (i.e. the program) and not any of the individual
>> components. This is why the default for libraries which have a
>> header-only configuration, should be a linkable library target, since
>> it creates the least headache.
>
> Wait, what?  Linkable are a huge headache to me, to the point where I'll
> seriously consider rewriting a third-party linkable library to be
> header-only just to avoid having to link to them.
>
> Problems with linkable libraries include:
>   - I have to compile them, which means either messing with their native
> build system, trying to get it to build on all of my platforms using all
> of my cross-compile toolchains, or replacing their native build system
> with my own.  The latter is often easier than the former.

This is not a difference between compiled libraries and
header only libraries, per se. It's a result of the fact
that being header-only forces you to write portable code,
because you can't rely on the build system to handle
complicated configuration steps.

If you make a compiled library that contains exactly the same
code that you would write for a header only library, "replace
the native build system" becomes "glob the sources and add
them to your project"

>   - If the library has linkable libraries as dependencies, I get to do
> the same thing for them, recursively.
>   - I have to make sure that I'm linking to the correct version of these
> libraries, i.e. not the system-wide installed versions.
>   - If I need to compile multiple copies of a library with different
> options, I get a combinatorial explosion of different libraries.
>
> My library build matrix is full of red entries where I haven't been able
> a particular library in a particular configuration that I need.  The
> green entries are often the result of days of work.  On the other hand,
> I've never had any trouble with header-only libraries.
>

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk