Git Product home page Git Product logo

Comments (11)

junghoahnsc avatar junghoahnsc commented on June 27, 2024

Just tried:

ERROR: /home/jungho.ahn/work/p/rules_protobuf_java_test/examples/proto/BUILD:19:1: error executing shell command: 'bazel-out/host/bin/external/com_github_google_protobuf/protoc --descriptor_set_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb.descriptor_set --java_out=bazel-out/local-fastbuild/genf...' failed: linux-sandbox failed: error executing command
  (cd /usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/execroot/rules_protobuf_java_test && \
  exec env - \
  /usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/execroot/rules_protobuf_java_test/_bin/linux-sandbox @/usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/execroot/rules_protobuf_java_test/bazel-sandbox/18414400-34a3-459f-89d0-39d3fd5e3623-1.params -- /bin/bash -c 'bazel-out/host/bin/external/com_github_google_protobuf/protoc --descriptor_set_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb.descriptor_set --java_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb_java.jar --plugin=protoc-gen-grpc-java=bazel-out/host/genfiles/external/org_pubref_rules_protobuf/third_party/protoc_gen_grpc_java/protoc_gen_grpc_java --grpc-java_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb_java.jar --proto_path=external/com_github_google_protobuf/src --proto_path=. examples/proto/common.proto').
external/com_github_google_protobuf/src: warning: directory does not exist.
google/protobuf/descriptor.proto: File not found.
examples/proto/common.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
examples/proto/common.proto:12:3: "google.protobuf.FileDescriptorProto" is not defined.
Target //examples/proto:java failed to build

from rules_protobuf.

pcj avatar pcj commented on June 27, 2024

Can you try pcj/rules_protobuf_java_test@2fb34ae? Could run into the same issue.

from rules_protobuf.

junghoahnsc avatar junghoahnsc commented on June 27, 2024

Sure. Yes, I got the same issue:

ubuntu-trusty-1:~/.../rules_protobuf_java_test/examples/proto] bazel build :java
.
WARNING: /usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/external/org_pubref_rules_protobuf/protobuf/internal/proto_compile.bzl:413:5: proto_compile examples/proto/BUILD:java.pb.
WARNING: /usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/external/org_pubref_rules_protobuf/protobuf/internal/proto_compile.bzl:380:5:
************************************************************
cd $(bazel info execution_root) && bazel-out/host/bin/external/com_github_google_protobuf/protoc \
--descriptor_set_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb.descriptor_set \
--java_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb_java.jar \
--plugin=protoc-gen-grpc-java=bazel-out/host/genfiles/external/org_pubref_rules_protobuf/third_party/protoc_gen_grpc_java/protoc_gen_grpc_java \
--grpc-java_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb_java.jar \
--proto_path=external/com_github_google_protobuf/src \
--proto_path=. \
examples/proto/common.proto
************************************************************
examples/proto/java.pb_java.jar
examples/proto/java.pb.descriptor_set
************************************************************
.
INFO: Found 1 target...
ERROR: /home/jungho.ahn/work/p/rules_protobuf_java_test/examples/proto/BUILD:27:1: error executing shell command: 'bazel-out/host/bin/external/com_github_google_protobuf/protoc --descriptor_set_out=bazel-out/local-fastbuild/genfiles/examples/proto/java.pb.descriptor_set --java_out=bazel-out/local-fastbuild/genf...' failed: linux-sandbox failed: error executing command /usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/execroot/rules_protobuf_java_test/_bin/linux-sandbox ... (remaining 5 argument(s) skipped).
external/com_github_google_protobuf/src: warning: directory does not exist.
google/protobuf/descriptor.proto: File not found.
examples/proto/common.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
examples/proto/common.proto:12:3: "google.protobuf.FileDescriptorProto" is not defined.
Target //examples/proto:java failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 33.262s, Critical Path: 20.48s

BTW, I'm also trying to generate for Go and Python, but Go failed like:

$ bazel build --spawn_strategy=standalone :goproto
ERROR: /home/jungho.ahn/work/p/rules_protobuf_java_test/examples/proto/BUILD:46:1: null failed: goproto.a.GoCompileFile.params failed: error executing command bazel-out/local-fastbuild/bin/examples/proto/bazel-out/local-fastbuild/bin/examples/proto/goproto.a.GoCompileFile.params: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
bazel-out/local-fastbuild/genfiles/examples/proto/common.pb.go:19: can't find import: "google/protobuf"
Target //examples/proto:goproto failed to build

BUILD:

go_proto_library(
    name = "goproto",
    protos = ["common.proto"],
    imports = ['external/com_github_google_protobuf/src'],
)

from rules_protobuf.

pcj avatar pcj commented on June 27, 2024

Assuming you called go_proto_repositories() in the WORKSPACE, looks like same issue.

from rules_protobuf.

junghoahnsc avatar junghoahnsc commented on June 27, 2024

Yes I called go_proto_repositories().
But with Go, it failed even when I gave --spawn_strategy=standalone.

from rules_protobuf.

junghoahnsc avatar junghoahnsc commented on June 27, 2024

Looks like there are two issues.

  1. I tried google/protobuf/timestamp.proto instead of descriptor.prot.
    It seems to work with deps= [ "@com_github_golang_protobuf//:ptypes/timestamp"],
    but it failed with deps= [ "@com_github_golang_protobuf//:ptypes"]
ERROR: /usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/external/com_github_golang_protobuf/BUILD:76:1: in go_library rule @com_github_golang_protobuf//:ptypes:
Traceback (most recent call last):
        File "/usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/external/com_github_golang_protobuf/BUILD", line 76
            go_library(name = 'ptypes')
        File "/usr/local/share/users/jungho.ahn/cache/bazel/_bazel_jungho.ahn/7d1ea5683c20646cb1228e609b45731f/external/io_bazel_rules_go/go/def.bzl", line 275, in go_library_impl
            fail("may not be empty", "srcs")
attribute srcs: may not be empty.
ERROR: Analysis of target '//examples/proto:proto_go' failed; build aborted.
  1. Unlike other google/protobuf/*, descriptor.proto has a different go_package.
    https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L43

I think M param should be passed to --go_out like Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor

and deps= [ "@com_github_golang_protobuf//:protoc-gen-go/descriptor" ] should be added.

from rules_protobuf.

junghoahnsc avatar junghoahnsc commented on June 27, 2024

Looks like it compiled with
proto_compile_args = { 'importmap': {'google/protobuf/descriptor.proto': 'github.com/golang/protobuf/protoc-gen-go/descriptor'}},

Is this a right way to do that?

from rules_protobuf.

pcj avatar pcj commented on June 27, 2024

Yes! (nice job, BTW).

It should be easier than all this.

  1. The importmap option should better exposed such as go_proto_library(importmap={...}).
  2. This should go in the go/README.md documentation.
  3. The importmapping in go is always a bit confusing. It would be nice to have a table that maps out the accessible protos that exist in the provided deps.

Do you agree? I'll make a PR to update 1.

from rules_protobuf.

junghoahnsc avatar junghoahnsc commented on June 27, 2024

Yeah. It would be better!

from rules_protobuf.

sblaes avatar sblaes commented on June 27, 2024

Did you have any success getting well known types to work with java_proto_library?

from rules_protobuf.

pcj avatar pcj commented on June 27, 2024

Closing due to inactivity.

from rules_protobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.