[build2] Linker Error when Installing build2 on Arch Linux using GCC 10.1.0

Boris Kolpackov boris at codesynthesis.com
Fri May 22 12:54:27 UTC 2020

Markus, thanks for the report.
Matthew, thanks for the in-depth analysis.

Matthew Krupcale <mkrupcale at matthewkrupcale.com> writes:

> These isra functions appear to be the result of IPA-SRA optimization,
> which has seen changes in GCC 10[2]. Building with
> config.cxx.coptions+="-fno-ipa-sra" using GCC 10 does appear to result
> in the WEAK symbols like from GCC 9 and successfully links exe{b}. I'm
> not sure if this is a GCC bug or an issue with how the functions are
> used or defined. Perhaps it is because the return value of
> insert_library is not always used in libbuild2/cc/{common,msvc}.cxx?

I looked around and one interesting thing about this function template
is that it's defined in one translation unit (common.cxx) but used in
two (common.cxx, msvc.cxx). The reason we expected this to work is
because instantiations in msvc.cxx are a subset of those in common.cxx.
But it seems GCC 10 doesn't think this is a good enough reason (and
probably correctly so, based on the letter of the standard).

I've now pushed a fix for this (as well as for the is_pod warning)
but haven't tested it with GCC 10 (we haven't made a build bot VM
for it yet). If you could give the latest staged toolchain[1] a go
and confirm this fixes it, that would be great.

[1] https://build2.org/community.xhtml#stage

More information about the users mailing list