-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Description
What version of protobuf and what language are you using?
Version:
- Protobuf : 21.12
- protoc : libprotoc 3.17.3
- Bazel : 5.4.0
- bazel depenedency:
http_archive(
name = "com_google_protobuf",
sha256 = "2118051b4fb3814d59d258533a4e35452934b1ddb41230261c9543384cbb4dfc",
strip_prefix = "protobuf-3.22.2",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.22.2.tar.gz"],
)
Language: Golang
What operating system (Linux, Windows, ...) and version?
MacOS Monterey - 12.6.3
What runtime / compiler are you using (e.g., python version or gcc version)
python - Python 3.8.8
What did you do?
When I do bazel build //...
, build should be succeeded.
What did you expect to see
Build Successful.
What did you see instead?
In file included from external/com_google_absl/absl/crc/internal/cpu_detect.cc:15:
In file included from external/com_google_absl/absl/crc/internal/cpu_detect.h:18:
In file included from external/com_google_absl/absl/base/config.h:86:
external/com_google_absl/absl/base/policy_checks.h:79:2: error: "C++ versions less than C++14 are not supported."
#error "C++ versions less than C++14 are not supported."
To resolve this issue, I have added the below snippet in WORKSPACE
.
http_archive(
name = "com_google_absl",
sha256 = "f88c0030547281e8283ff183db61564ff08d3322a8c2e2de4c40e38c03c69aea",
strip_prefix = "abseil-cpp-c27ab06897f330267bed99061ed3e523e2606bf1",
urls = ["https://github.com/abseil/abseil-cpp/archive/c27ab06897f330267bed99061ed3e523e2606bf1.zip"],
)
But I got below error:
/external/com_google_protobuf/src/google/protobuf/compiler/BUILD.bazel:101:11: no such package '@com_google_absl//absl/log': BUILD file not found in directory 'absl/log' of external repository @com_google_absl. Add a BUILD file to a directory to mark it as a package. and referenced by '@com_google_protobuf//src/google/protobuf/compiler:protoc_lib_nowkt'
I tried the below workaround as well.
bazel build --action_env=BAZEL_CXXOPTS="-std=c++20" //...
But no luck.
Anything else we should know about your project / environment
I have to use grpc-gateway library which uses 3.22.2. So it throws below error if I downgrade the version to 3.21.7.
version_service.pb.gw.go:16:2: imported and not used: "github.com/golang/protobuf/ptypes/empty"
version_service.pb.gw.go:36:15: undefined: emptypb
version_service.pb.gw.go:53:15: undefined: emptypb