Hi,
I'm trying to set up my working environment on my Mac M2.
I want to use Bazel for building my projects when using gRPC and I'm struggling with making it build.
I'm using the example from
here with one exception: I'm using grpc 1.51.1 instead by specifying:
http_archive(
name = "com_github_grpc_grpc",
sha256 = "b55696fb249669744de3e71acc54a9382bea0dce7cd5ba379b356b12b82d4229",
strip_prefix = "grpc-1.51.1",
)
When I try to run bazel build ... I get the following error:
INFO: Analyzed 5 targets (141 packages loaded, 4492 targets configured).
INFO: Found 5 targets...
INFO: From Generating Descriptor Set proto_library @com_github_cncf_udpa//xds/service/orca/v3:pkg:
xds/service/orca/v3/orca.proto:14:1: warning: Import validate/validate.proto is unused.
INFO: From Generating Descriptor Set proto_library @com_github_cncf_udpa//xds/type/v3:pkg:
xds/type/v3/typed_struct.proto:10:1: warning: Import validate/validate.proto is unused.
ERROR: /home/or/.cache/bazel/_bazel_or/72d6b6069a50c7d00e12c5ccd81a12ad/external/com_github_grpc_grpc/BUILD:524:16: Compiling src/core/plugin_registry/grpc_plugin_registry_extra.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 113 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/com_github_grpc_grpc/src/core/lib/avl/avl.h:26,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:40,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gpr/useful.h: In function 'int grpc_core::QsortCompare(const absl::lts_20220623::variant<Alts ...>&, const absl::lts_20220623::variant<Alts ...>&)':
external/com_github_grpc_grpc/src/core/lib/gpr/useful.h:109:17: error: use of 'auto' in lambda parameter declaration only available with '-std=c++14' or '-std=gnu++14'
109 | [&](const auto& x) {
| ^~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'grpc_core::RefCountedPtr<T>& grpc_core::RefCountedPtr<T>::operator=(grpc_core::RefCountedPtr<T>&&)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:58:16: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
58 | reset(std::exchange(other.value_, nullptr));
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'grpc_core::RefCountedPtr<T>& grpc_core::RefCountedPtr<T>::operator=(grpc_core::RefCountedPtr<Y>&&)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:63:16: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
63 | reset(std::exchange(other.value_, nullptr));
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'void grpc_core::RefCountedPtr<T>::reset(T*)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:109:25: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
109 | T* old_value = std::exchange(value_, value);
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'void grpc_core::RefCountedPtr<T>::reset(const grpc_core::DebugLocation&, const char*, T*)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:114:25: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
114 | T* old_value = std::exchange(value_, value);
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'T* grpc_core::RefCountedPtr<T>::release()':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:134:30: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
134 | T* release() { return std::exchange(value_, nullptr); }
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'grpc_core::WeakRefCountedPtr<T>& grpc_core::WeakRefCountedPtr<T>::operator=(grpc_core::WeakRefCountedPtr<T>&&)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:201:16: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
201 | reset(std::exchange(other.value_, nullptr));
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'grpc_core::WeakRefCountedPtr<T>& grpc_core::WeakRefCountedPtr<T>::operator=(grpc_core::WeakRefCountedPtr<Y>&&)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:206:16: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
206 | reset(std::exchange(other.value_, nullptr));
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'void grpc_core::WeakRefCountedPtr<T>::reset(T*)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:252:25: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
252 | T* old_value = std::exchange(value_, value);
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted.h:32,
from external/com_github_grpc_grpc/src/core/lib/gprpp/orphanable.h:29,
from external/com_github_grpc_grpc/src/core/lib/gprpp/dual_ref_counted.h:28,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:43,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h: In member function 'void grpc_core::WeakRefCountedPtr<T>::reset(const grpc_core::DebugLocation&, const char*, T*)':
external/com_github_grpc_grpc/src/core/lib/gprpp/ref_counted_ptr.h:257:25: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
257 | T* old_value = std::exchange(value_, value);
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/load_balancing/lb_policy.h:49,
from external/com_github_grpc_grpc/src/core/lib/load_balancing/lb_policy_registry.h:31,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:27,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/resolver/server_address.h: In member function 'virtual std::unique_ptr<grpc_core::ServerAddress::AttributeInterface> grpc_core::ServerAddressWeightAttribute::Copy() const':
external/com_github_grpc_grpc/src/core/lib/resolver/server_address.h:128:17: error: 'make_unique' is not a member of 'std'
128 | return std::make_unique<ServerAddressWeightAttribute>(weight_);
| ^~~~~~~~~~~
external/com_github_grpc_grpc/src/core/lib/resolver/server_address.h:128:17: note: 'std::make_unique' is only available from C++14 onwards
external/com_github_grpc_grpc/src/core/lib/resolver/server_address.h:128:57: error: expected primary-expression before '>' token
128 | return std::make_unique<ServerAddressWeightAttribute>(weight_);
| ^
In file included from external/com_github_grpc_grpc/src/core/lib/service_config/service_config_parser.h:32,
from external/com_github_grpc_grpc/src/core/lib/service_config/service_config.h:30,
from external/com_github_grpc_grpc/src/core/lib/resolver/resolver.h:33,
from external/com_github_grpc_grpc/src/core/lib/resolver/resolver_registry.h:32,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:28,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/validation_errors.h: In constructor 'grpc_core::ValidationErrors::ScopedField::ScopedField(grpc_core::ValidationErrors::ScopedField&&)':
external/com_github_grpc_grpc/src/core/lib/gprpp/validation_errors.h:80:24: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
80 | : errors_(std::exchange(other.errors_, nullptr)) {}
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
In file included from external/com_github_grpc_grpc/src/core/lib/service_config/service_config_parser.h:32,
from external/com_github_grpc_grpc/src/core/lib/service_config/service_config.h:30,
from external/com_github_grpc_grpc/src/core/lib/resolver/resolver.h:33,
from external/com_github_grpc_grpc/src/core/lib/resolver/resolver_registry.h:32,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:28,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_github_grpc_grpc/src/core/lib/gprpp/validation_errors.h: In member function 'grpc_core::ValidationErrors::ScopedField& grpc_core::ValidationErrors::ScopedField::operator=(grpc_core::ValidationErrors::ScopedField&&)':
external/com_github_grpc_grpc/src/core/lib/gprpp/validation_errors.h:83:22: error: 'exchange' is not a member of 'std'; did you mean 'absl::lts_20220623::exchange'?
83 | errors_ = std::exchange(other.errors_, nullptr);
| ^~~~~~~~
In file included from external/com_google_absl/absl/types/optional.h:39,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args.h:34,
from external/com_github_grpc_grpc/src/core/lib/channel/channel_args_preconditioning.h:25,
from external/com_github_grpc_grpc/src/core/lib/config/core_configuration.h:25,
from external/com_github_grpc_grpc/src/core/plugin_registry/grpc_plugin_registry_extra.cc:21:
external/com_google_absl/absl/utility/utility.h:314:3: note: 'absl::lts_20220623::exchange' declared here
314 | T exchange(T& obj, U&& new_value) {
| ^~~~~~~~
INFO: Elapsed time: 395.123s, Critical Path: 16.42s
INFO: 692 processes: 33 internal, 659 linux-sandbox.
FAILED: Build did NOT complete successfully
Any idea what's wrong here?
Thanks!