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

MacOS build failure: printer/google/protobuf/io/printer.h:94:55: error: unused parameter 'semantic' [-Werror,-Wunused-parameter] #12313

Closed
jtattermusch opened this issue Mar 22, 2023 · 8 comments

Comments

@jtattermusch
Copy link
Contributor

I'm building on MacOS as part of the grpc bazel build. I'm getting this error:

In file included from src/compiler/cpp_generator.cc:19:
In file included from ./src/compiler/cpp_generator.h:30:
In file included from ./src/compiler/config.h:24:
In file included from ./src/compiler/config_protobuf.h:33:
bazel-out/host/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/printer/google/protobuf/io/printer.h:94:55: error: unused parameter 'semantic' [-Werror,-Wunused-parameter]
                             absl::optional<Semantic> semantic) {
                                                      ^
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
ERROR: /Volumes/BuildData/tmpfs/altsrc/github/grpc/src/proto/grpc/testing/BUILD:177:19 Middleman _middlemen/_S_Ssrc_Sproto_Sgrpc_Stesting_Ctest_Uproto-BazelCppSemantics_build_arch_darwin-opt failed: (Aborted): wrapped_clang_pp failed: error executing command

https://source.cloud.google.com/results/invocations/7bed9dcc-9f09-410f-a4cd-443267f9af94/log

Canonical bazel command:
bazel --max_idle_secs=10800 --noshutdown_on_low_sys_mem --connect_timeout_secs=30 --output_user_root=/var/tmp/_bazel_kbuilder --output_base=/private/var/tmp/_bazel_kbuilder/56f0bf568ea4b00a9aa3000e432900f1 --failure_detail_out=/private/var/tmp/_bazel_kbuilder/56f0bf568ea4b00a9aa3000e432900f1/failure_detail.rawproto --expand_configs_in_place --idle_server_tasks --write_command_log --nowatchfs --nofatal_event_bus_exceptions --nowindows_enable_symlinks --client_debug=false --host_jvm_args=-Djava.net.preferIPv6Addresses=true --host_jvm_args=-Dbazel.DigestFunction=SHA256 --ignore_all_rc_files test --enable_platform_specific_config --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --jvmopt=-Djava.net.preferIPv6Addresses --copt=-DGRPC_BAZEL_BUILD --host_copt=-DGRPC_BAZEL_BUILD --action_env=GRPC_BAZEL_RUNTIME=1 --define=use_fast_cpp_protos=true --invocation_id=7bed9dcc-9f09-410f-a4cd-443267f9af94 --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh --remote_instance_name=projects/grpc-testing/instances/default_instance --auth_enabled=true --remote_cache=grpcs://remotebuildexecution.googleapis.com --bes_backend=grpcs://buildeventservice.googleapis.com --bes_timeout=600s --bes_results_url=https://source.cloud.google.com/results/invocations/ --project_id=grpc-testing --test_tag_filters=-no_mac --build_tag_filters=-no_mac --define=use_strict_warning=true --dynamic_mode=off --verbose_failures=true --test_output=errors --test_env=GRPC_VERBOSITY=debug --google_credentials=/tmpfs/src/gfile/GrpcTesting-d0eeee2db331.json --remote_upload_local_results=true --remote_default_exec_properties=grpc_cache_silo_key1=83d8e488-1ca9-40fd-929e-d37d13529c99 --remote_default_exec_properties=grpc_cache_silo_key2=20221213-1155monterey-MacService --config=opt --compilation_mode=opt --copt=-Wframe-larger-than=16384 -- //test/...

I'm building on MacOS monterey (standard kokoro worker)

@jtattermusch jtattermusch added the untriaged auto added to all issues by default when created. label Mar 22, 2023
@jtattermusch
Copy link
Contributor Author

@deannagarcia @mkruskal-google this is one of the issues that block grpc's upgrade to 22.x

@jtattermusch
Copy link
Contributor Author

Indeed, the parameter semantic seems unused, so it's not surprising that it triggers and error via "-Werror,-Wunused-parameter"

absl::optional<Semantic> semantic) {

@fowles
Copy link
Contributor

fowles commented Mar 22, 2023

We don't support compiling with arbitrary warning flags. It is simply not sustainable as some warnings are mutually contradictory.

@jtattermusch
Copy link
Contributor Author

Got that, but given that gRPC's upgrade to protobuf 22.x has been dragging on for quite a while now and there are still several other issues to resolve with the upgrade, IMHO fixing this one warning would make our lives much easier.
gRPC actually enables the unused-parameter warning in quite a few builds and the draft PR to upgrade us to protobuf 22.x is already way too complex and makes many other necessary adjustment.

So if we fix this warning (seems trivial to fix) and backport it to 22.x branch, it would help us prevent bloating the upgrade PR even more and allow us to focus on real problems with the upgrade instead. WDYT?

@fowles
Copy link
Contributor

fowles commented Mar 23, 2023

We will accept a patch and cherry pix for this, but it can break again without any notice.

@deannagarcia
Copy link
Member

What do we mean by "fix" here? I think the fix the protobuf team wants is for this warning to be explicitly excluded in this file: https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/port_def.inc. Would that work for grpc?

@jtattermusch
Copy link
Contributor Author

I think whatever makes the "unused parameter" errors go away works

This is one of our builds that uses strict warnings (and has the broadest scope among all of them I htink). You can run the build on glinux at https://github.com/jtattermusch/grpc/tree/repro_protobuf_12313

bazel build --define=use_strict_warning=true -- \
  :all \
  //src/core/... \
  //src/compiler/... \
  //test/... \
  //examples/... \
  -//examples/android/binder/...

It should reproduce the error as mentioned above.

@jtattermusch
Copy link
Contributor Author

Simplified repro is bazel build --keep_going --define=use_strict_warning=true //src/compiler:grpc_cpp_plugin

copybara-service bot pushed a commit that referenced this issue Mar 28, 2023
This fixes #12313

PiperOrigin-RevId: 520052990
copybara-service bot pushed a commit that referenced this issue Mar 28, 2023
deannagarcia added a commit to deannagarcia/protobuf that referenced this issue Mar 28, 2023
deannagarcia added a commit that referenced this issue Mar 28, 2023
* Suppress -Wunused-parameter warning for GCC and clang.

Closes #12313

PiperOrigin-RevId: 520066451

* Remove unintended cherrypicked line
@googleberg googleberg removed the untriaged auto added to all issues by default when created. label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants