Page MenuHomePhabricator

[cmake] Make dependencies of lldb libraries private, take 2

Authored by labath on Oct 17 2016, 8:28 AM.



The dependencies of our libraries (only liblldb, really) we marked as public, which caused all
their dependencies to be repeated when linking any executables to them. This is a problem because
then all the .a files could end up being linked twice, once to liblldb and once
again to to the executable linking against liblldb (lldb, lldb-mi). As it turns out,
our build actually depends on this behavior:

  • on windows, lldb does not have getopt, so it pulls it from inside liblldb, even though getopt is not a part of the exported interface of liblldb (maybe some of the bsd variants have this problem as well)
  • lldb-mi uses llvm, which again is not exported by liblldb

This change does not actually fix these problems (that is going to be a hard
one), but it does make them explicit by moving this magic from add_lldb_library
to the places the executable targets are defined. That way, I can link the
additional .a files only on targets that really need it, and the other targets
can build cleanly and make sure we don't regress further. It also fixes the
LLVM_LINK_LLVM_DYLIB build on linux.

Diff Detail


Event Timeline

labath updated this revision to Diff 74854.Oct 17 2016, 8:28 AM
labath retitled this revision from to [cmake] Make dependencies of lldb libraries private, take 2.
labath updated this object.
labath added reviewers: zturner, beanz.
labath added a subscriber: lldb-commits.
beanz accepted this revision.Oct 17 2016, 9:20 PM
beanz edited edge metadata.


This revision is now accepted and ready to land.Oct 17 2016, 9:20 PM

@sylvestre.ledru : I believe this will fix the LINK_LLVM_DYLIB issue you were encountering. Let me know if you're still having problems after this.
@emaste @krytarowski : This has potential to break linking on *BSD. I'll keep an eye on the bots and respond accordingly.

This revision was automatically updated to reflect the committed changes.

Looks fine, thanks.