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

Bazel BUILD file: grpc++_unsecure does not build (v1.0.x branch) #7851

Closed
mrry opened this issue Aug 24, 2016 · 2 comments
Closed

Bazel BUILD file: grpc++_unsecure does not build (v1.0.x branch) #7851

mrry opened this issue Aug 24, 2016 · 2 comments

Comments

@mrry
Copy link

mrry commented Aug 24, 2016

When attempting to build the latest code from the v1.0.x as part of TensorFlow, I got the following errors:

ERROR: /var/lib/jenkins/workspace/tensorflow-cl-cpu/bazel-ci_build-cache/.cache/bazel/_bazel_jenkins/eab0d61a99b6696edb3d2aff87b585e8/external/grpc/BUILD:1637:1: C++ compilation of rule '@grpc//:grpc++_unsecure' failed: gcc failed: error executing command 
  (cd /var/lib/jenkins/workspace/tensorflow-cl-cpu/bazel-ci_build-cache/.cache/bazel/_bazel_jenkins/eab0d61a99b6696edb3d2aff87b585e8/execroot/workspace && \
  exec env - \
    LD_LIBRARY_PATH='' \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -MD -MF bazel-out/local-fastbuild/bin/external/grpc/_objs/grpc++_unsecure/external/grpc/src/core/lib/iomgr/closure.pic.d -fPIC -iquote external/grpc -iquote bazel-out/local-fastbuild/genfiles/external/grpc -iquote external/protobuf -iquote bazel-out/local-fastbuild/genfiles/external/protobuf -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -iquote external/nanopb_git -iquote bazel-out/local-fastbuild/genfiles/external/nanopb_git -isystem external/grpc/include -isystem bazel-out/local-fastbuild/genfiles/external/grpc/include -isystem external/grpc -isystem bazel-out/local-fastbuild/genfiles/external/grpc -isystem external/protobuf/src -isystem bazel-out/local-fastbuild/genfiles/external/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/grpc/src/core/lib/iomgr/closure.c -o bazel-out/local-fastbuild/bin/external/grpc/_objs/grpc++_unsecure/external/grpc/src/core/lib/iomgr/closure.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/grpc/src/core/lib/iomgr/closure.c: In function 'grpc_closure_list_fail_all':
external/grpc/src/core/lib/iomgr/closure.c:62:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (grpc_closure *c = list->head; c != NULL; c = c->next_data.next) {
   ^
external/grpc/src/core/lib/iomgr/closure.c:62:3: note: use option -std=c99 or -std=gnu99 to compile your code

For some reason a .c file is being compiled as part of building the (C++) grpc++_unsecure library. That library doesn't have a -std=gnu99 copt, so we get a failure. On further inspection (i) this code is included in grpc_unsecure, and attempting to link grpc++_unsecure into a shared object fails because it links both grpc++_unsecure.a and grpc_unsecure.a, and some symbols are defined in both.

The solution seems to be to remove all of the .c files from the grpc++_unsecure rule. We're doing that in TensorFlow with a substituted BUILD file (not yet public), but we'd love to switch the upstream one from gRPC!

(FWIW, it looks like the grpc++ rule might have the same problem.)

@ioctl0
Copy link

ioctl0 commented Aug 30, 2016

FWIW, grpc++ definitely doesn't build either, with the same root cause. The symptom I'm seeing is tons of duplicate symbols at link time -- most of the .c files are srcs for both the 'grpc++' target and 'grpc', which it depends on.

@xyzzyz
Copy link
Contributor

xyzzyz commented Sep 9, 2016

I think #8055 should fix this.

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

No branches or pull requests

8 participants