[build2] Missing include?: build2-0.11.0/build2/target.txx:23: undefined reference to `build2::resolve_members`

Boris Kolpackov boris at codesynthesis.com
Fri Aug 2 14:09:21 UTC 2019


Matthew Krupcale <mkrupcale at matthewkrupcale.com> writes:

> Upon inspection, I believe that build2/version/rule.cxx does not
> #include build2/algorithm.hxx which defines (in build2/algorithm.ixx)
> build2::resolve_members, as is done for all the other
> build2/*rule.cxx. I'm not entirely sure why this only fails sometimes
> though because the definition should be present when linking with the
> other build2/*.o files that do #include build2/algorithm.hxx.

This (and a couple of other functions) are inline. It's clear why this
could lead to a link error (if at all other call sites it was inlined,
then there would no non-inline symbol). It's a bit puzzling why it only
happens sometimes (unless there were changes in the optimization level
or some such).


> However, I wonder if it might just make more sense to #include
> build2/algorithm.hxx inside build2/target.hxx, since resolve_members
> is used by build2/target.{i,t}xx.

Those two files actually have a few cyclic dependencies. We've
resolved this by making one side of the dependency non-inline:

https://git.build2.org/cgit/build2/commit/?id=8e69e09b7ec68377758c63092f9b254e95a0d7be


> PS: I presume this will also apply to the restructuring going on
> build2->libbuild2.

Speaking of which, this will probably affect your package. However,
I wouldn't look into this just yet, it is still not finished. I
was planning to ping you and Alex once this restructuring gets
finalized.



More information about the users mailing list