abseil-cpp
abseil-cpp copied to clipboard
Mac M1 Failing Bazel Build When Trying to Build cpp_grpc_library
Describe the bug
Bazel build fails when trying to build cpp_grpc_library
:
$ bazel build --copt="-Wno-error=deprecated-copy" //networking:pod_cc_proto
INFO: Analyzed target //networking:pod_cc_proto (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_vulcan/8c1801317d32dd0e271100c0f6118973/external/upb/upbc/BUILD:44:10: Compiling upbc/message_layout.cc [for host] failed: (Aborted): wrapped_clang failed: error executing command external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG '-DNS_BLOCK_ASSERTIONS=1' ... (remaining 55 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/upb/upbc/message_layout.cc:26:
In file included from external/upb/upbc/message_layout.h:32:
In file included from external/com_google_absl/absl/container/flat_hash_map.h:40:
In file included from external/com_google_absl/absl/container/internal/hash_function_defaults.h:56:
In file included from external/com_google_absl/absl/strings/cord.h:78:
external/com_google_absl/absl/functional/function_ref.h:124:16: error: definition of implicit copy constructor for 'FunctionRef<void (absl::string_view)>' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
FunctionRef& operator=(const FunctionRef& rhs) = delete;
^
external/com_google_absl/absl/strings/cord.h:1325:33: note: in implicit copy constructor for 'absl::FunctionRef<void (absl::string_view)>' first required here
return ForEachChunkAux(rep, callback);
^
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
Target //networking:pod_cc_proto failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.426s, Critical Path: 1.27s
INFO: 13 processes: 9 internal, 4 darwin-sandbox.
FAILED: Build did NOT complete successfully
Steps to reproduce the bug
You can find all the code for the project here. The BUILD target in question that causes the issue is here.
What version of Abseil are you using?
Not sure -- seems like its being imported from the grpc rules
What operating system and version are you using
Mac OS Monterrey Version 12.2.1 Apple M1
What compiler and version are you using?
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
What build system are you using?
bazel 4.2.1-homebrew
Additional context
Most relevant issue I could find was #948 -- but adding --copt="-Wno-error=deprecated-copy"
to bazel build did not seem to change anything. Would greatly appreciate any set of eyes on this issue!
What version of Abseil are you using?
Not sure -- seems like its being imported from the grpc rules
Can you please try to reproduce this with the latest version?
What version of Abseil are you using? Not sure -- seems like its being imported from the grpc rules
Can you please try to reproduce this with the latest version?
I am using the latest gRPC version, so I can only presume that I am using the latest version? I am not sure how to verify that -- I tried graphing the bazel dependency tree as well as searching absl
in the gRPC repository to find a version, but no luck. I am not sure how I would even change it if I was able to find it.
Same issue here. For me it started after I update to Monterey 12.3 and had to re-install Xcode
$> xcodebuild -version
Xcode 13.3 Build version 13E113
It seems that the errors are for a different version since the lines in the error messages do not match the code in the repo. For example, the line cord.h:1325
in the error message is line 1499. Similar for function_ref.h:124
. The code there is the same but this indicates that we are using an older version.
For me, reverting back to Xcode 13.2.1 fixed it
Thanks @tzovas! That worked! For anyone else, just remember to delete the failed cached build. Closing this issue since it is fixed now!
I had the same issue with an Intel Mac and reverting back to Xcode 13.2.1 also solved the issue for me. However I would consider this to be more of a temporary fix as we cannot stay on this specific version of Xcode forever. Can we reopen the issue?
I had the same issue with an Intel Mac and reverting back to Xcode 13.2.1 also solved the issue for me. However I would consider this to be more of a temporary fix as we cannot stay on this specific version of Xcode forever. Can we reopen the issue?
That is a fair point. Reopening to see if we can get some more eyes on this
This should be fixed, but downstream projects haven't updated to the lastest version. We can't do anything about that.
I also have no idea why --copt="-Wno-error=deprecated-copy" is not suppressing the error.
I can confirm for macOS Monterey Intel. The same error as below happens. PWD=/proc/self/cwd
external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/external/upb/upbc/objs/protoc-gen-upb/protoc-gen-upb.d '-frandom-seed=bazel-out/host/bin/external/upb/upbc/objs/protoc-gen-upb/protoc-gen-upb.o' -iquote external/upb -iquote bazel-out/host/bin/external/upb -iquote external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -iquote external/zlib -iquote bazel-out/host/bin/external/zlib -iquote external/com_google_absl -iquote bazel-out/host/bin/external/com_google_absl -iquote external/bazel_tools -iquote bazel-out/host/bin/external/bazel_tools -isystem external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -isystem external/zlib/zlib/include -isystem bazel-out/host/bin/external/zlib/zlib/include -g0 -g0 -Wextra -Werror -Wno-long-long -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/upb/upbc/protoc-gen-upb.cc -o bazel-out/host/bin/external/upb/upbc/_objs/protoc-gen-upb/protoc-gen-upb.o)
Execution platform: @local_config_platform//:host
Use --sandbox_debug to see verbose messages from the sandbox In file included from external/upb/upbc/protoc-gen-upb.cc:28: In file included from external/com_google_absl/absl/container/flat_hash_map.h:40: In file included from external/com_google_absl/absl/container/internal/hash_function_defaults.h:56: In file included from external/com_google_absl/absl/strings/cord.h:78: external/com_google_absl/absl/functional/function_ref.h:124:16: error: definition of implicit copy constructor for 'FunctionRef<void (absl::string_view)>' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy] FunctionRef& operator=(const FunctionRef& rhs) = delete; ^ external/com_google_absl/absl/strings/cord.h:1325:33: note: in implicit copy constructor for 'absl::FunctionRef<void (absl::string_view)>' first required here return ForEachChunkAux(rep, callback); ^ 1 error generated. (17:09:31) INFO: Elapsed time: 198.929s, Critical Path: 29.76s (17:09:31) INFO: 2195 processes: 767 remote cache hit, 670 internal, 741 darwin-sandbox, 17 worker. (17:09:31) FAILED: Build did NOT complete successfully
Same issue here. On an intel x86-64 mac, with Mac OS 12.4