Skip to content

Missing dependencies in installation instructions #5

@haikalpribadi

Description

@haikalpribadi

Hi,

In the README.md it simply says that we need to add {lang}:deps.bzl to our WORKSPACE file. For example:

git_repository(
    name = "org_pubref_rules_proto",
    remote = "https://github.com/pubref/rules_proto",
    commit = "27da2e7af9e4a1c43c584be2f05be8a301a642b6",
)
load("@org_pubref_rules_proto//java:deps.bzl", "java_grpc_compile")
java_grpc_compile()

However, trying to run java_grpc_compile after this leads to an error:

ERROR: /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/protocol/BUILD:20:1: every rule of type proto_compile implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: no such package '@com_google_protobuf//'

So then I added @com_google_protobuf as a dependency:

http_archive(
    name = "com_google_protobuf",
    sha256 = "0a4c6d0678eb2f063df332cff1a41647ef692c067b5cfb19e51bca778e79d9e0",
    strip_prefix = "protobuf-3.6.1",
    urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.zip"],
)

Now I get a different error:

ERROR: /private/var/tmp/_bazel_haikalpribadi/3cdeaa1301f056ec7b4e7ee46bda5c79/external/com_github_grpc_grpc/BUILD:2039:1: no such target '//external:protobuf_headers': target 'protobuf_headers' not declared in package 'external' defined by /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/WORKSPACE and referenced by '@com_github_grpc_grpc//:grpc++_config_proto'
ERROR: /private/var/tmp/_bazel_haikalpribadi/3cdeaa1301f056ec7b4e7ee46bda5c79/external/com_github_grpc_grpc/BUILD:388:1: no such target '//external:protobuf_clib': target 'protobuf_clib' not declared in package 'external' defined by /Users/haikalpribadi/Workspace/repos/graknlabs/grakn/WORKSPACE and referenced by '@com_github_grpc_grpc//:grpc_plugin_support'

So I suspected that I'm missing @com_github_grpc_grpc, so I added:

git_repository(
    name = "com_github_grpc_grpc",
    remote = "https://github.com/grpc/grpc",
    tag = "v1.15.1"
)

However, it still gives the error as shown above, so I checked in your WORKSPACE file and saw that you had the following two lines to load grpc_deps.bzl, and I copied them into my WORKSPACE file.

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", com_github_grpc_grpc_bazel_grpc_deps = "grpc_deps")
com_github_grpc_grpc_bazel_grpc_deps()

Now everything works fine, and the proto files compile. However, I'm worried that I'm doing something wrong/unnecessary above, as you did not put them in your documentation. Thus, my questions are:

  1. Is the above code needed in my WORKSPACE? Because I thought {lang}:deps.bzl was going to take care of it. But if it is needed, ...
    a. Why is it needed? If not, then ...
    b. Is there a simpler approach which I should have taken?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions