This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix remote index build for macOS with Homebrew-installed gRPC and Protobuf
ClosedPublic

Authored by kbobyrev on May 4 2020, 7:04 PM.

Diff Detail

Event Timeline

kbobyrev created this revision.May 4 2020, 7:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2020, 7:04 PM
sammccall added inline comments.May 5 2020, 5:42 AM
llvm/cmake/modules/FindGRPC.cmake
26

how does the conditional logic/recovery around this work?
e.g. what if it's installed in the system, but not via homebrew? What if homebrew is available, but grpc or protobuf are not installed?

kbobyrev marked an inline comment as done.May 5 2020, 9:05 AM
kbobyrev added inline comments.
llvm/cmake/modules/FindGRPC.cmake
26

For now, there is no recovery or workaround. The only way to have system-installed install grpc + protobuf other than Homebrew would probably be compiling and doing make install but I don't think people are happy with doing that (and if they are already building it then it'd be better to use GRPC_INSTALL_PATH). Homebrew is de-facto the standard package manager for macOS and while I could check if Homebrew is found and if the packages are install and fall back to the "default" case when if they aren't we assume gRPC headers, libraries and binaries are all in the search paths I think that would be optimising for weird setups nobody is likely to use.

WDYT?

kbobyrev updated this revision to Diff 262563.May 7 2020, 1:03 AM

Recover when Homebrew is not a available or gRPC + Protobuf are not installed through Homebrew.

kbobyrev updated this revision to Diff 263111.May 11 2020, 1:02 AM

Rebase on top of master.

sammccall added inline comments.May 11 2020, 1:20 AM
llvm/cmake/modules/FindGRPC.cmake
26

This could use some comments, "fall back to homebrew-installed libraries, which typically aren't on the system path."

26

this block should only run if we didn't already find the proto tools, right?

57

at this point it would be nice to have have a cmake check that protoc and grpc_cpp_plugin both exist, and that we can include the proto and grpc headers.
This would ensure we get errors at configure time instead of build time.

(unrelated though, separate change if you want to do this)

kbobyrev updated this revision to Diff 263119.May 11 2020, 1:52 AM
kbobyrev marked 4 inline comments as done.

Resolve review comments.

llvm/cmake/modules/FindGRPC.cmake
26

Not really, the proto tools are in $PATH, but include directories and libraries aren't in default search paths.

57

Good point! I've added a check for protoc and grpc_cpp_plugin and a FIXME regarding the ability to include headers. I'll do that in a separate patch.

kbobyrev updated this revision to Diff 263120.May 11 2020, 1:53 AM

systtem -> system

sammccall accepted this revision.May 11 2020, 3:20 AM
This revision is now accepted and ready to land.May 11 2020, 3:20 AM
This revision was automatically updated to reflect the committed changes.