C++ Bazel build :grpc++ fails because -Werror,-Wunused-parameter

570 views
Skip to first unread message

Albert Lockett

unread,
Nov 6, 2021, 9:44:29 AM11/6/21
to grpc.io
Hi - I'm trying to get started on a new GRCP project written in C++. I'm using Bazel as a build tool. I'm using a bare-bones configuration and it's failing to build.

this is using release 1.41.1 (635693ce624f3b3a89e5a764f0664958ef08b2b9)

WORKSPACE

workspace(name = "myproj")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_github_grpc_grpc",
urls = [
],
strip_prefix = "grpc-635693ce624f3b3a89e5a764f0664958ef08b2b9",
)
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps() BUILD
cc_binary(
name = "main",
srcs = [
"main.cpp",
],
defines = ["BAZEL_BUILD"],
deps = [
"@com_github_grpc_grpc//:grpc++",
],
)
Running bazel build :all produces the following error: DEBUG: Rule 'com_github_grpc_grpc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "bd2ec83a5ed255950daa00e5c8a557a97b8ae20e530757c6c07ea4d78c846caa" DEBUG: Repository com_github_grpc_grpc instantiated at: /Users/albert.lockett2/Development/myproj/WORKSPACE:5:13: in <toplevel> Repository rule http_archive defined at: /private/var/tmp/_bazel_albert.lockett2/fdc77f09a5335393a1ec30d3d123ee8d/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel> INFO: Analyzed target //:main (1 packages loaded, 2 targets configured). INFO: Found 1 target... ERROR: /private/var/tmp/_bazel_albert.lockett2/fdc77f09a5335393a1ec30d3d123ee8d/external/upb/upbc/BUILD:63:10: Compiling upbc/protoc-gen-upbdefs.cc [for host] failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 49 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox In file included from external/upb/upbc/protoc-gen-upbdefs.cc:31: In file included from /usr/local/include/google/protobuf/descriptor.pb.h:24: /usr/local/include/google/protobuf/arena.h:445:18: error: unused parameter 'p' [-Werror,-Wunused-parameter] const T* p, std::false_type /*has_get_arena*/) { ^ 1 error generated. Target //:main failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 3.117s, Critical Path: 2.92s INFO: 55 processes: 47 internal, 8 darwin-sandbox. FAILED: Build did NOT complete successfully Does anyone have a working minimal grpc c++ setup using bazel that they'd be willing to share?

Nicolas Noble

unread,
Nov 6, 2021, 12:15:51 PM11/6/21
to Albert Lockett, grpc.io
From your workspace, you're in control of which build switch you're passing. Disable the offending flags. Feel free to inspire yourself from the current setup grpc uses for building using bazel:



--
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/8b219344-aeaf-4adf-84fd-e933df1eb0ben%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages