That last error is a known problem with protobuf; you've run make, and that
leaves files around that confuses Bazel. Please clean the protobuf
subdirectory using git clean -f -d -x for example.

On Wed, Jun 28, 2017 at 9:37 AM, Yukang Yang <[email protected]> wrote:

> Hi Nicolas,
>
> Thanks for reply!
>
> 1. Problem in GRPC's example (https://github.com/grpc/grpc/
> blob/master/examples/BUILD):
>
> I just git pull. Now I am at the same commit as you. But It still doesn't
> build, although this time it is a different error message. I am not sure if
> I am the only person who can get this error. Here is what I did:
>
> $ cd GRPC_REPOSITORY
> $ git show --oneline
> c4f85b78f3 (HEAD -> master, origin/master, origin/HEAD) Merge pull request
> #11474 from makdharma/cares_fix
> // same commit as yours
>
> $ ~/bazel version
> Build label: 0.5.2- (@non-git)
> // brew hasn't updated bazel and 0.5.1 has a bug. I built bazel from 0.5.2
> distribution package
>
> $ ~/bazel build examples/...
> external/com_google_protobuf/BUILD.bazel:367:1: in cc_binary rule
> @com_google_protobuf//:protoc: cycle in dependency graph:
>     //examples:_auth_sample_codegen
>     //external:protocol_compiler (host)
> .-> @com_google_protobuf//:protoc (host)
> |   @com_google_protobuf//:protoc_lib (host)
> |   @com_google_protobuf//:protobuf (host)
> |   @com_google_protobuf//:src/google/protobuf/util/internal/
> testdata/timestamp_duration.pb.h (host)
> |   @com_google_protobuf//:cc_test_protos_genproto (host)
> `-- @com_google_protobuf//:protoc (host)
> This cycle occurred because of a configuration option.
> ERROR: Analysis of target '//examples:_auth_sample_codegen' failed; build
> aborted.
> // I checked protobuf BUILD file and I don't know how is
> @com_google_protobuf//:protobuf depends on a target of
> timestamp_duration.pb.h.
>
> 2. Problem in my own example (https://bitbucket.org/xyyk/gr
> pc-example/overview):
>
> I realized that more stuff is needed in WORKSPACE of my own example. Now I
> have went through all errors of "BUILD file not found", added missing
> external dependency and bind in my WORKSPACE, and fixed all of them. I no
> longer get any error about package or BUILD. But this time it seems bazel
> cannot output cc files successfully.
>
> $ cd MY_OWN_EXAMPLE
> $ ~/bazel build :helloworld
>
> ERROR: /Users/yukang/git-projects/grpc-example/BUILD:31:1: output
> 'rotos/helloworld.pb.h' was not created.
> ERROR: /Users/yukang/git-projects/grpc-example/BUILD:31:1: output 'rotos/
> helloworld.pb.cc' was not created.
> ERROR: /Users/yukang/git-projects/grpc-example/BUILD:31:1: not all
> outputs were created or valid.
> ERROR: /Users/yukang/git-projects/grpc-example/BUILD:31:1: output
> 'rotos/helloworld.grpc.pb.h' was not created.
> ERROR: /Users/yukang/git-projects/grpc-example/BUILD:31:1: output 'rotos/
> helloworld.grpc.pb.cc' was not created.
> Target //:helloworld failed to build
>
> It shows output as 'rotos/.....', while the output should actually be
> 'protos/.....' (the first letter 'p' is missing). This looks like a bazel
> issue. I also tried to build with -s
>
> $ ~/bazel clean
> $ ~/bazel build :helloworld -s
>
> Last output before the error is often this one:
> >>>>> # //:_helloworld_codegen [action 'Generating rotos/helloworld.pb.h']
> (cd 
> /private/var/tmp/_bazel_yukang/daf269fd3c8ea3827a82b98ac2b45027/execroot/__main__
> && \
>   exec env - \
>   bazel-out/host/bin/external/com_google_protobuf/protoc
> '--cpp_out=:bazel-out/darwin_x86_64-fastbuild/genfiles'
> '-Iprotos/helloworld.proto=protos/helloworld.proto'
> protos/helloworld.proto)
>
> If I run the command as is, i.e. first cd into __main__, and then use exec
> env - bazel-out....., my terminal crashes immediately. I don't know where I
> can find any error log about the crash.
>
> The interesting thing is if I modify this command by a little. I still cd
> into __main__,  remove 'exec env - ' and run only 'bazel-out/..../protoc
> ....'. It works. and I can see the output cc files in my bazel-out. This
> looks like a bazel issue.
>
>
> On Tuesday, June 27, 2017 at 5:13:36 PM UTC-7, Nicolas Noble wrote:
>>
>> So, first, you can't just grab a portion of the tree and expect it to
>> work elsewhere. What's important is that it's able to find the WORKSPACE
>> file properly. So your second test with the copy wouldn't work without a
>> proper WORKSPACE file. Plus some of the examples are referring to files
>> down the tree, such as, well, the grpc library itself.
>>
>> Then, the error itself you're seeing seems is an old one that was fixed a
>> while ago, so I'm not sure you're really at head here.
>>
>> :~/sources/grpc (master)$ git show --oneline
>> c4f85b7 Merge pull request #11474 from makdharma/cares_fix
>>
>> :~/sources/grpc (master)$ bazel build examples/...
>> INFO: Found 18 targets...
>> INFO: Elapsed time: 102.154s, Critical Path: 9.91s
>> :~/sources/grpc (master)$ ./bazel-bin/examples/greeter_server &
>> [1] 11025
>> I0628 02:05:58.983490133   11025 server_builder.cc:254]      Synchronous
>> server. Num CQs: 4, Min pollers: 1, Max Pollers: 2, CQ timeout (msec): 10000
>> Server listening on 0.0.0.0:50051
>> :~/sources/grpc (master)$ ./bazel-bin/examples/greeter_client
>> Greeter received: Hello world
>>
>>
>> On Mon, Jun 26, 2017 at 10:15 AM, Yukang Yang <[email protected]> wrote:
>>
>>> Hi GRPC experts,
>>>
>>> I found the proto in GRPC example doesn't build with bazel. I used GRPC
>>> from head. bazel is got from brew install bazel.
>>>
>>> Here is what I did:
>>>
>>> git clone https://github.com/grpc/grpc.git
>>> cd grpc
>>> git pull && git submodule init && git submodule update && git submodule
>>> status
>>> cd examples
>>> bazel build :helloworld
>>>
>>> I got:
>>>
>>> ERROR: /Users/yukang/git-projects/grpc/WORKSPACE:16:1: no such package
>>> '@com_google_protobuf//': In new_local_repository rule //external:com_go
>>> ogle_protobuf the 'build_file' attribute does not specify an existing
>>> file (/Users/yukang/git-projects/grpc/third_party/protobuf/BUILD does
>>> not
>>>  exist) and referenced by '//external:protobuf'.
>>> ERROR: Analysis of target '//examples:helloworld' failed; build aborted.
>>>
>>> I have verified that 
>>> /Users/yukang/git-projects/grpc/third_party/protobuf/BUILD
>>> exists.
>>>
>>> I also copied example out of GRPC repository and tried to set up an
>>> external dependency on grpc repository.
>>>
>>> Here is what I did:
>>>
>>> https://bitbucket.org/xyyk/grpc-example/overview
>>>
>>> git clone [email protected]:xyyk/grpc-example.git
>>> cd grpc-example
>>> bazel build :helloworld
>>>
>>> I got:
>>>
>>> ERROR: error loading package '': Extension file not found. Unable to
>>> load package for '@grpc//bazel:grpc_build_system.bzl': BUILD file not
>>> found on package path.
>>>
>>> I also saw the post at http://www.grpc.io/blog/bazel_rules_protobuf.
>>> But their example at https://github.com/pubref/grpc_greetertimer
>>> doesn't build either.
>>>
>>> Does someone know what is wrong here?
>>>
>>> Thanks,
>>> Yukang
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "grpc.io" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/grpc-io.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/grpc-io/b7f43ecb-0ebf-47d4-a0aa-20157f210881%40googlegroups.com
>>> <https://groups.google.com/d/msgid/grpc-io/b7f43ecb-0ebf-47d4-a0aa-20157f210881%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/c2399379-61f5-4ed4-a65f-446248a3c8b6%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/c2399379-61f5-4ed4-a65f-446248a3c8b6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAEvr0PFHLXkeW0duAW%3DsVvAeV%3DqY7YM5Xtj6SbyX_JWyf2NkUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to