Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dependencies in installation instructions #5

Open
haikalpribadi opened this issue Oct 2, 2018 · 4 comments
Open

Missing dependencies in installation instructions #5

haikalpribadi opened this issue Oct 2, 2018 · 4 comments

Comments

@haikalpribadi
Copy link

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?
@haikalpribadi
Copy link
Author

Actually, after I added com_github_grpc_grpc, I can even delete com_google_protobuf:

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"],
)

After deleting the above, my build still works. So in the end, only com_github_grpc_grpc is needed. Why is that?

@haikalpribadi
Copy link
Author

Here are my dependencies.bzl and WORKSPACE files for you to see the end result.

@pcj
Copy link
Contributor

pcj commented Oct 2, 2018

Appreciate your understanding, getting started instructions could use some tuneup! Yes, com_grpc_grpc_com and it's grpc_deps() loads alot of dependencies that overlap in other areas.

Effective visualization of the dependency graph of workspace loading rules would be a useful feature in bazel.

@haikalpribadi
Copy link
Author

Sorry, I didn't get that, @pcj. Do we actually need to import @com_github_grpc_grpc and not some other configuration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants