Error building grpc with bazel on Ubuntu 18.04.4

44 views
Skip to first unread message

nisarg...@gmail.com

unread,
Feb 2, 2020, 5:05:30 PM2/2/20
to grpc.io
I'm following the steps at https://github.com/grpc/grpc/blob/master/BUILDING.md to build grpc from source for Ubuntu 18.04.4. So far I've executed the following commands successfully.

$ sudo apt-get install build-essential autoconf libtool pkg-config
$ sudo apt-get install libgflags-dev
$ sudo apt-get install clang-5.0 libc++-dev
$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
$ cd grpc

When I try to build it with bazel, I get the following error -

$ ~/private/bazel-2.0.0-linux-x86_64 build :all
Starting local Bazel server and connecting to it...
DEBUG: Rule 'io_bazel_rules_python' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1523916428 -0700"
DEBUG: Call stack for the definition of repository 'io_bazel_rules_python' which is a git_repository (rule definition at /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
- /nobackup/grpc/WORKSPACE:34:1
ERROR: /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/io_bazel_rules_python/python/pip.bzl:39:25: Traceback (most recent call last):
File "/home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/io_bazel_rules_python/python/pip.bzl", line 37
repository_rule(<2 more arguments>)
File "/home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/io_bazel_rules_python/python/pip.bzl", line 39, in repository_rule
attr.label(allow_files = True, <2 more arguments>)
'single_file' is no longer supported. use allow_single_file instead. You can use --incompatible_disable_deprecated_attr_params=false to temporarily disable this check.
ERROR: error loading package '': Extension file 'python/pip.bzl' has errors
ERROR: error loading package '': Extension file 'python/pip.bzl' has errors
INFO: Elapsed time: 4.947s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

How do I resolve this?

Thanks
Nisarg

nisarg...@gmail.com

unread,
Feb 2, 2020, 5:33:25 PM2/2/20
to grpc.io
I tried building it with v1.26.0 tag instead of v1.25.0, and now I get the following error -

$ ~/private/bazel-2.0.0-linux-x86_64 build :all
Starting local Bazel server and connecting to it...
DEBUG: /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:9:
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:125:9: rbe_default not using checked in configs; Bazel version 2.0.0 was picked/selected but no checked in config was found in map {"0.20.0": ["8.0.0"], "0.21.0": ["8.0.0"], "0.22.0": ["8.0.0", "9.0.0"], "0.23.0": ["8.0.0", "9.0.0"], "0.23.1": ["8.0.0", "9.0.0"], "0.23.2": ["9.0.0"], "0.24.0": ["9.0.0"], "0.24.1": ["9.0.0"], "0.25.0": ["9.0.0"], "0.25.1": ["9.0.0"], "0.25.2": ["9.0.0"], "0.26.0": ["9.0.0"], "0.26.1": ["9.0.0"], "0.27.0": ["9.0.0"], "0.27.1": ["9.0.0"], "0.28.0": ["9.0.0"], "0.28.1": ["9.0.0"], "0.29.0": ["9.0.0"], "0.29.1": ["9.0.0", "10.0.0"], "1.0.0": ["9.0.0", "10.0.0"]}
DEBUG: /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:9:
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:125:9: rbe_msan not using checked in configs; Bazel version 2.0.0 was picked/selected but no checked in config was found in map {"0.20.0": ["8.0.0"], "0.21.0": ["8.0.0"], "0.22.0": ["8.0.0", "9.0.0"], "0.23.0": ["8.0.0", "9.0.0"], "0.23.1": ["8.0.0", "9.0.0"], "0.23.2": ["9.0.0"], "0.24.0": ["9.0.0"], "0.24.1": ["9.0.0"], "0.25.0": ["9.0.0"], "0.25.1": ["9.0.0"], "0.25.2": ["9.0.0"], "0.26.0": ["9.0.0"], "0.26.1": ["9.0.0"], "0.27.0": ["9.0.0"], "0.27.1": ["9.0.0"], "0.28.0": ["9.0.0"], "0.28.1": ["9.0.0"], "0.29.0": ["9.0.0"], "0.29.1": ["9.0.0", "10.0.0"], "1.0.0": ["9.0.0", "10.0.0"]}
INFO: SHA256 (https://boringssl.googlesource.com/boringssl/+archive/83da28a68f32023fd3b95a8ae94991a07b1f6c62.tar.gz) = 716abb8f6ab9df203ec6c603fd58c865b8a8d66e564177061862c2e1dab2499f
DEBUG: Rule 'boringssl' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "716abb8f6ab9df203ec6c603fd58c865b8a8d66e564177061862c2e1dab2499f"
DEBUG: Call stack for the definition of repository 'boringssl' which is a http_archive (rule definition at /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/bazel_tools/tools/build_defs/repo/http.bzl:292:16):
 - /nobackup/grpc/bazel/grpc_deps.bzl:105:9
 - /nobackup/grpc/WORKSPACE:5:1
INFO: Analyzed 96 targets (51 packages loaded, 2990 targets configured).
INFO: Found 96 targets...
ERROR: /home/nisargs/.cache/bazel/_bazel_nisargs/4e4151a9a278b0177b97ca89f46caad9/external/upb/BUILD:57:1: C++ compilation of rule '@upb//:upb' failed (Exit 1) clang failed: error executing command /s/std/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -MD -MF ... (remaining 21 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/upb/upb/encode.c:3:
In file included from external/upb/upb/encode.h:8:
In file included from external/upb/upb/msg.h:13:
/usr/include/string.h:33:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
1 error generated.
INFO: Elapsed time: 190.567s, Critical Path: 3.10s

INFO: 0 processes.
FAILED: Build did NOT complete successfully

Nicolas Noble

unread,
Feb 3, 2020, 11:49:58 AM2/3/20
to nisarg...@gmail.com, grpc.io
We're not Bazel 2.0 ready yet.

--
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 grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/e7cf6e99-98e1-46d6-9245-4e8bb9c21bb6%40googlegroups.com.

Nisarg Shah

unread,
Feb 3, 2020, 1:16:03 PM2/3/20
to Nicolas Noble, grpc.io
Thanks Nicolas, I tried building ti with bazel 1.0.0 and it fails with this error -

$ ~/private/bazel-1.0.0-linux-x86_64 build :all

Starting local Bazel server and connecting to it...
INFO: Writing tracer profile to '/home/nisargs/.cache/bazel/_bazel_nisargs/509de2f44a35a9c68f4268d75d0fe17a/command.profile.gz'
DEBUG: /home/nisargs/.cache/bazel/_bazel_nisargs/509de2f44a35a9c68f4268d75d0fe17a/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:226:13: rbe_msan not using checked in configs; Bazel version 1.0.0 was picked/selected with '["9.0.0", "10.0.0"]' compatible configs but none match the 'env = {"ABI_LIBC_VERSION": "glibc_2.19", "ABI_VERSION": "clang", "BAZEL_COMPILER": "clang", "BAZEL_HOST_SYSTEM": "i686-unknown-linux-gnu", "BAZEL_TARGET_CPU": "k8", "BAZEL_TARGET_LIBC": "glibc_2.19", "BAZEL_TARGET_SYSTEM": "x86_64-unknown-linux-gnu", "CC": "clang", "CC_TOOLCHAIN_NAME": "linux_gnu_x86", "BAZEL_LINKOPTS": "-lc++:-lc++abi:-lm"}', 'config_repos = None',and/or 'create_cc_configs = True' passed as attrs
INFO: SHA256 (https://boringssl.googlesource.com/boringssl/+archive/83da28a68f32023fd3b95a8ae94991a07b1f6c62.tar.gz) = f1fde09c75c73890a6453943b7e4161b34f3d4f0f0478bc6325f73d18086f190
DEBUG: Rule 'boringssl' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "f1fde09c75c73890a6453943b7e4161b34f3d4f0f0478bc6325f73d18086f190"
DEBUG: Call stack for the definition of repository 'boringssl' which is a http_archive (rule definition at /home/nisargs/.cache/bazel/_bazel_nisargs/509de2f44a35a9c68f4268d75d0fe17a/external/bazel_tools/tools/build_defs/repo/http.bzl:262:16):
 - /nobackup/grpc-temp/grpc/bazel/grpc_deps.bzl:105:9
 - /nobackup/grpc-temp/grpc/WORKSPACE:5:1
INFO: Analyzed 96 targets (52 packages loaded, 3117 targets configured).
INFO: Found 96 targets...
ERROR: /home/nisargs/.cache/bazel/_bazel_nisargs/509de2f44a35a9c68f4268d75d0fe17a/external/upb/BUILD:57:1: C++ compilation of rule '@upb//:upb' failed (Exit 1) clang failed: error executing command /s/std/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -MD -MF bazel-out/k8-fastbuild/bin/external/upb/_objs/upb/port.pic.d ... (remaining 20 argument(s) skipped)


Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/upb/upb/port.c:2:
external/upb/upb/upb.h:12:10: fatal error: 'stdarg.h' file not found
#include <stdarg.h>
         ^~~~~~~~~~
1 error generated.
INFO: Elapsed time: 197.128s, Critical Path: 3.69s

INFO: 0 processes.
FAILED: Build did NOT complete successfully

Here is clang version info

$ /s/std/bin/clang --version
clang version 8.0.0 (trunk 340542)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /s/std/bin

Thanks
Nisarg

Nicolas Noble

unread,
Feb 3, 2020, 1:28:40 PM2/3/20
to Nisarg Shah, grpc.io
This one indicates something is aloof with your compiler environment. stdarg.h is supposed to be a system header.

Richard Belleville

unread,
Feb 3, 2020, 2:34:41 PM2/3/20
to grpc.io

Nisarg,

I'm not able to reproduce.

I ran under the ubuntu:18.04 docker image with Bazel 2.0:

root@6cd6278876b8:/grpc# tools/bazel --version
INFO: Running bazel wrapper (see //tools/bazel for details), bazel version 2.0.0 will be used instead of system-wide bazel installation.
bazel 2.0.0

I installed just a few system packages:
root@6cd6278876b8:/grpc# history
    1  cd /grpc
    2  apt-get update -y && apt-get install -y python python3 clang
    3  tools/bazel build //:all
    4  tools/bazel --version
    5  history

And the build completed successfully:
INFO: Analyzed 98 targets (30 packages loaded, 2910 targets configured).
INFO: Found 98 targets...
INFO: Elapsed time: 83.488s, Critical Path: 16.32s
INFO: 1364 processes: 1364 processwrapper-sandbox.
INFO: Build completed successfully, 1535 total actions

I am using master instead of the latest release. Perhaps that's what's making the difference?
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages