cgrushko / proto_library

Apache License 2.0
39 stars 20 forks source link

java_lite_proto_library failed to work #1

Closed thaidn closed 6 years ago

thaidn commented 7 years ago

Thanks for working on this, it's really useful and has saved me a lot of time.

java_proto_library works perfectly for me, but I'm getting this error with java_lite_proto_library:

ERROR: /private/var/tmp/_bazel_thaidn/df2e59bf257c59e48735734d799e3be1/external/com_google_protobuf_javalite/protobuf.bzl:91:19: name 'HOST_CFG' is not defined.

It seems related to https://github.com/google/protobuf/pull/2761, but I can't tell what I should do to fix it. Any idea?

Cheers!

thaidn commented 7 years ago

This is what I'm having in my workspace:

http_archive( name = "com_google_protobuf_javalite", urls = ["https://github.com/google/protobuf/archive/82809aaebf24fca3c2d5611149c78a3625bd3b70.zip"], strip_prefix = "protobuf-82809aaebf24fca3c2d5611149c78a3625bd3b70", sha256 = "75105f312cefd8aa5e0bdf29279dc8ef0a6f862362b321d35b1ed5c08ce2ecfb", )

Let me try to upgrade to protobuf HEAD.

thaidn commented 7 years ago

If I change it to 1387a6795c743fa41a21e8e1501953cb018be760 which is HEAD of protobuf, I get this error:

ERROR: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf_javalite//:javalite_toolchain', but this target could not be found because of: no such target '@com_google_protobuf_javalite//:javalite_toolchain': target 'javalite_toolchain' not declared in package '' (did you mean 'java_toolchain'?) defined by /private/var/tmp/_bazel_thaidn/df2e59bf257c59e48735734d799e3be1/external/com_google_protobuf_javalite/BUILD.

http_archive( name = "com_google_protobuf_javalite", urls = ["https://github.com/google/protobuf/archive/1387a6795c743fa41a21e8e1501953cb018be760.zip"], strip_prefix = "protobuf-1387a6795c743fa41a21e8e1501953cb018be760", sha256 = "22a3dc57c86684cc16c4bcb377a382e8d98b506653fc7f5208f7560cbe5b42a9", )

thaidn commented 7 years ago

Changing to javalite doesn't work either:

http_archive( name = "com_google_protobuf_javalite", urls = ["https://github.com/google/protobuf/archive/javalite.zip"], strip_prefix = "protobuf-javalite", )

Error:

every rule of type proto_library implicitly depends upon the target '@com_google_protobuf_javalite//:javalite_toolchain', but this target could not be found because of: no such target '@com_google_protobuf_javalite//:javalite_toolchain': target 'javalite_toolchain' not declared in package '' (did you mean 'java_toolchain'?) defined by /private/var/tmp/_bazel_thaidn/df2e59bf257c59e48735734d799e3be1/external/com_google_protobuf_javalite/BUILD.

cgrushko commented 7 years ago

From https://github.com/cgrushko/proto_library/blob/043568c176128d959efad52c50b6dbc2cdf4b6e7/src/BUILD,

# Uncomment when the following issue are resolved:
#   https://github.com/google/protobuf/issues/2762
#   https://github.com/google/protobuf/pull/2761
#   https://github.com/google/protobuf/issues/2434 (for javalite)

The first error you got was fixed in https://github.com/google/protobuf/pull/2761, but https://github.com/google/protobuf/issues/2762 remains the real blocker.

Unfortunately, this is something the protobuf team must do. You can help by showing your interest :)

aj-michael commented 7 years ago

Is this issue still open? the linked protobuf issues appear to have been closed

thaidn commented 6 years ago

java_lite_proto_library is working well now.