This is an archive of the discontinued LLVM Phabricator instance.

gn build: Add support for building LLDB on Linux.
ClosedPublic

Authored by pcc on Sep 8 2021, 1:53 PM.

Details

Summary

On Linux, LLDB depends on lldb-server at runtime (is it different on
Mac?), so I created a top-level lldb target that will build both lldb
and lldb-server.

Diff Detail

Event Timeline

pcc created this revision.Sep 8 2021, 1:53 PM
pcc requested review of this revision.Sep 8 2021, 1:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2021, 1:53 PM
thakis accepted this revision.Sep 8 2021, 3:04 PM

Very cool. LG with top-level BUILD.gn comment addressed :)

llvm/utils/gn/secondary/BUILD.gn
15

Does this build fine on windows?

Generally this only depends on the test targets which in turn depend on the binaries, so probably should only have the old/test dep in this file anyways.

This revision is now accepted and ready to land.Sep 8 2021, 3:04 PM
pcc added inline comments.Sep 8 2021, 3:28 PM
llvm/utils/gn/secondary/BUILD.gn
15

You're right, this needs to avoid the dependency on lldb on Windows targets.

The problem with only depending on //lldb/test is that nothing else refers to //lldb, so ninja lldb wouldn't also build lldb-server. Maybe it would be better to add lldb-server to the data_deps of //lldb/tools/driver:lldb instead then.

pcc updated this revision to Diff 371464.Sep 8 2021, 3:46 PM

Move to data_deps

thakis added inline comments.Sep 8 2021, 4:21 PM
llvm/utils/gn/secondary/BUILD.gn
15

I guess //lldb/test could depend on //:lldb instead of //lldb/tools/driver?

We currently don't use data_deps anywhere else. (I have https://github.com/nico/llvm-project/commit/7246393c6bbc270044641415ffb0db93ffee3e29 on a branch, but uploads with static links take so long that it isn't really worth it. Maybe I should revisit that with -fno-semantic-interposition…)

pcc added inline comments.Sep 8 2021, 5:18 PM
llvm/utils/gn/secondary/BUILD.gn
15

And then //:lldb would depend on lldb and the various lldb-servers? I suppose that could work.

It seems like clang's existing dependency on e.g. clang-offload-bundler, which is the sort of dependency we want here, is currently added via deps, and I see that your change moves that to data_deps. For executable->executable dependencies I suppose that deps means the same thing as data_deps (test isolation aside) but to be consistent with what's in clang maybe we should just stick to what I have here except with s/data_deps/deps/g.

thakis added inline comments.Sep 8 2021, 5:22 PM
llvm/utils/gn/secondary/BUILD.gn
15

sgtm.

thakis added a comment.Sep 8 2021, 6:32 PM

(Please watch http://45.33.8.238/ when landing this :) )

This revision was landed with ongoing or failed builds.Sep 8 2021, 7:35 PM
This revision was automatically updated to reflect the committed changes.