Skip to content

objc_proto_library fails with error message #1802

Closed

Description

@dnkoutso

Given:

proto_library(
    name = "protos",
    srcs = ["foo.proto"]
)

objc_proto_library(
    name = "objc_protos",
    deps = ["protos"],
)

Results in:

ERROR: /Users/dnkoutso/Development/ios/sample-monorepo/Frameworks/protos/BUILD:6:1: every rule of type objc_proto_library implicitly depends upon the target '@bazel_tools//tools/objc:compile_protos', but this target could not be found because of: no such target '@bazel_tools//tools/objc:compile_protos': target 'compile_protos' not declared in package 'tools/objc' defined by /private/var/tmp/_bazel_dnkoutso/bcca89e91e31c3214400660a1b84dd36/external/bazel_tools/tools/objc/BUILD.
ERROR: /Users/dnkoutso/Development/ios/sample-monorepo/Frameworks/protos/BUILD:6:1: every rule of type objc_proto_library implicitly depends upon the target '@bazel_tools//tools/objc:proto_support', but this target could not be found because of: no such target '@bazel_tools//tools/objc:proto_support': target 'proto_support' not declared in package 'tools/objc' (did you mean 'protobuf_support'?) defined by /private/var/tmp/_bazel_dnkoutso/bcca89e91e31c3214400660a1b84dd36/external/bazel_tools/tools/objc/BUILD.

Is objc protobuf support fully implemented and working or am I missing something?

Activity

  1. dnkoutso commented on Sep 20, 2016

    @dnkoutso
    Author

    Both of these targets are non-existent in tools/objc

  2. laszlocsomor commented on Sep 21, 2016

    @laszlocsomor
    Contributor

    You're perfectly right, this is a bug, we ought to have those targets in tools/objc/BUILD.

    Weird, the relevant code was added ages ago, yet the BUILD file, as far as I can tell, never had these targets. It appears you're the first one to use it :)

  3. added
    P2
    on Sep 21, 2016
  4. laszlocsomor commented on Sep 21, 2016

    @laszlocsomor
    Contributor

    @sergiocampama You added the relevant lines, do you know how to create the missing targets in //tools/objc/BUILD?

  5. sergiocampama commented on Sep 21, 2016

    @sergiocampama
    Contributor

    objc_proto_library is not ready to be used, as the scripts in tools/objc say:

    https://github.com/bazelbuild/bazel/blob/master/tools/objc/protobuf_compiler.py

    so even if we add dummy targets, nothing will be generated/compiled...

  6. dnkoutso commented on Sep 21, 2016

    @dnkoutso
    Author

    Thanks for confirming, seems like we will have to implement it with a custom build rule for now.

  7. pcj commented on Sep 22, 2016

    @pcj
    Member

    If all you need are the objective-c outputs from protoc, consider https://github.com/pubref/rules_protobuf/tree/master/objc#objc_proto_compile.

    I have not had time to focus much on the gathering the dependencies for an objc_proto_library implementation but would invite you to contribute.

  8. makdharma commented on May 2, 2017

    @makdharma

    Is objc_proto_library ready to be used? The documentation at https://bazel.build/versions/master/docs/be/objective-c.html#objc_proto_library seems to say so, but I still can't use it because the target compile_protos is not in the tools/objc/BUILD file. Please either add the target or fix the documentation.

  9. thaidn commented on Jul 27, 2017

    @thaidn

    Has objc_proto_library worked yet? We want to use it in github.com/google/tink.

  10. tl0gic commented on Sep 25, 2017

    @tl0gic

    Any update on this? We really want to use it in github.com/google/tink. Thanks! :)

  11. pcj commented on Sep 25, 2017

    @pcj
    Member

    @thaidn Glad at least the code in rules_protobuf worked for you 😺

  12. thaidn commented on Sep 25, 2017

    @thaidn

    @pcj your code has saved us countless hours. thank you very much!

  13. spinorx commented on Oct 23, 2017

    @spinorx

    @pcj - I need dependencies for objc to be propagated. When I have X depending on Y both objc_proto_library, I get error which says headers generated by Y is not found. How do I propagate the dependencies? I can make the change if I am pointed in right direction.

    I do see both headers generated though. The error happens when objc_library builds the generated X.m file.

  14. pcj commented on Oct 23, 2017

    @pcj
    Member

    @spinorx Can you file an issue on rules_protobuf, ideally with a repro? (Will be easier to track there). Thanks.

  15. spinorx commented on Oct 23, 2017

    @spinorx
  16. ob commented on Sep 26, 2018

    @ob
    Contributor

    Is objc_proto_library ready. to be used now @sergiocampama ? I'm still getting the same error:

    ERROR: /Users/obonilla/o/bazel-tests/objc-proto/x/BUILD:6:1: every rule of type objc_proto_library implicitly depends upon the target '@bazel_tools//tools/objc:protobuf_lib', but this target could not be found because of: no such target '@bazel_tools//tools/objc:protobuf_lib': target 'protobuf_lib' not declared in package 'tools/objc' defined by /private/var/tmp/_bazel_obonilla/b3ec2a683ae91108aaaf199a84fecf9a/external/bazel_tools/tools/objc/BUILD
    
  17. sergiocampama commented on Oct 1, 2018

    @sergiocampama
    Contributor

    No, objc_proto_library is not functional yet. We haven't had the time to prioritize this work.

  18. added
    z-team-Apple
    and removed on May 15, 2020
  19. added
    team-Rules-CPP
    and removed
    z-team-Apple
    on Oct 30, 2020
  20. added
    P4
    and removed
    P2
    on Nov 24, 2020
  21. sgowroji commented on Jan 23, 2023

    @sgowroji
    Member

    Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4team-Rules-CPPtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions