diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-01-11 09:10:45 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-01-11 09:10:45 +0200 |
commit | db9c25a915f66d07a3451192adcda219a850ce61 (patch) | |
tree | 37ecc29f6133f30be31ed133591bdc878897356b /libbuild2/cc/pkgconfig.cxx | |
parent | a8017ff4b661305a71fe98813d0118b6c3876c52 (diff) |
Add extra diagnostics around pkg-config library resolution
Diffstat (limited to 'libbuild2/cc/pkgconfig.cxx')
-rw-r--r-- | libbuild2/cc/pkgconfig.cxx | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx index 6c0f1fc..75c7227 100644 --- a/libbuild2/cc/pkgconfig.cxx +++ b/libbuild2/cc/pkgconfig.cxx @@ -811,11 +811,17 @@ namespace build2 // @@ If by some reason this is the library itself (doesn't go // first or libpkgconf parsed libs in some bizarre way) we will - // hang trying to lock it's target inside search_library() (or - // fail an assertion if run serially) as by now it is already - // locked. To be safe we probably shouldn't rely on the position - // and filter out all occurrences of the library itself (by - // name?) and complain if none were encountered. + // have a dependency cycle by trying to lock its target inside + // search_library() as by now it is already locked. To be safe + // we probably shouldn't rely on the position and filter out + // all occurrences of the library itself (by name?) and + // complain if none were encountered. + // + // Note also that the same situation can occur if we have a + // binful library for which we could not find the library + // binary and are treating it as binless. We now have a diag + // frame around the call to search_library() to help diagnose + // such situations. // libs.push_back (name (move (o))); continue; @@ -1002,7 +1008,19 @@ namespace build2 prerequisite_key pk { nullopt, {&lib::static_type, &out, &out, &nm, nullopt}, &s}; - if (const target* lt = search_library (a, top_sysd, usrd, pk)) + const target* lt; + { + auto df = make_diag_frame ( + [&pc, &l](const diag_record& dr) + { + location f (pc.path); + dr << info (f) << "while resolving pkg-config dependency " << l; + }); + + lt = search_library (a, top_sysd, usrd, pk); + } + + if (lt != nullptr) { // We used to pick a member but that doesn't seem right since the // same target could be used with different link orders. |