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

Bazel conflicts with natively installed protoc #183

Closed
kjeet opened this issue Mar 15, 2022 · 2 comments
Closed

Bazel conflicts with natively installed protoc #183

kjeet opened this issue Mar 15, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@kjeet
Copy link

kjeet commented Mar 15, 2022

Issue Description

First time Bazel user here working through the the Java example. Presumably, Bazel builds should not be interacting with, nor conflicting with packages installed on the system so I'm filing a bug for what seems to be an unintentional problematic interaction with files outside of the build system.

I ran into the same issue as referenced here: protocolbuffers/protobuf#5376
for which the fix that worked was rm -rf /usr/local/Cellar/protobuf;

From that link it seems like it's conflicting with a brew installed version:

brew uses protobuf --installed

Log Output

INFO: Analyzed target //:thing_java_proto (31 packages loaded, 4713 targets configured).
INFO: Found 1 target...
ERROR: /Users/kgill/Snapchat/Dev/.cache/_bazel_root/d75b8d725b9270ec906ac7dbbc5520fa/external/com_google_protobuf/BUILD:155:11: Compiling src/google/protobuf/stubs/statusor.cc [for host] failed: (Exit 1): cc_wrapper.sh failed: error executing command 
  (cd /Users/kgill/Snapchat/Dev/.cache/_bazel_root/d75b8d725b9270ec906ac7dbbc5520fa/sandbox/darwin-sandbox/9/execroot/__main__ && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  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 -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/statusor.d '-frandom-seed=bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/statusor.o' -iquote external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -isystem external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -g0 -g0 -DHAVE_ZLIB -Wmissing-field-initializers -Woverloaded-virtual -Wno-sign-compare -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_protobuf/src/google/protobuf/stubs/statusor.cc -o bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/statusor.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/com_google_protobuf/src/google/protobuf/stubs/statusor.cc:31:
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:178:48: error: no member named 'UnknownError' in namespace 'google::protobuf::util'
inline StatusOr<T>::StatusOr() : status_(util::UnknownError("")) {}
                                         ~~~~~~^
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:183:21: error: no member named 'InternalError' in namespace 'google::protobuf::util'
    status_ = util::InternalError("OkStatus() is not a valid argument.");
              ~~~~~~^
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:192:21: error: no member named 'InternalError' in namespace 'google::protobuf::util'
    status_ = util::InternalError("nullptr is not a valid argument.");
              ~~~~~~^
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:194:21: error: no member named 'OkStatus' in namespace 'google::protobuf::util'
    status_ = util::OkStatus();
              ~~~~~~^
4 errors generated.
Target //:thing_java_proto failed to build
INFO: Elapsed time: 43.813s (0.73m), Critical Path: 1.45s (0.02m)
INFO: 40 processes: 1 remote cache hit, 39 internal (2.50%).
INFO: Build Event Protocol files produced successfully.
FAILED: Build did NOT complete successfully

rules_proto_grpc Version

rules_proto_grpc-4.1.1

Bazel Version

4.1.0.23

OS

macOS

Link to Demo Repo

No response

WORKSPACE Content

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_proto_grpc",
    sha256 = "507e38c8d95c7efa4f3b1c0595a8e8f139c885cb41a76cab7e20e4e67ae87731",
    strip_prefix = "rules_proto_grpc-4.1.1",
    urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.1.1.tar.gz"],
)

load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_toolchains", "rules_proto_grpc_repos")
rules_proto_grpc_toolchains()
rules_proto_grpc_repos()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()

load("@rules_proto_grpc//java:repositories.bzl", rules_proto_grpc_java_repos = "java_repos")
rules_proto_grpc_java_repos()

BUILD Content

proto_library(
    name = "thing_proto",
    srcs = ["..."],
    deps = ["@com_google_protobuf//:any_proto"],
)

load("@rules_proto_grpc//java:defs.bzl", "java_proto_library")
java_proto_library(
    name = "thing_java_proto",
    protos = [":thing_proto"]
)

Proto Content

No response

Any Other Content

No response

@kjeet kjeet added the bug Something isn't working label Mar 15, 2022
@aaliddell
Copy link
Member

I'm not sure there's anything I can do in this repo to fix this, as the bug appears to be during the compilation of protobuf itself, which is the responsibility of the com_google_protobuf repo you've linked.

@kjeet
Copy link
Author

kjeet commented Mar 15, 2022

@aaliddell Ah thanks for the response, I couldn't tell from the output. Hopefully I can get this issue reopened up there.

@kjeet kjeet closed this as completed Mar 16, 2022
@kjeet kjeet changed the title Bazel conflicts with natively installed protoc. Bazel conflicts with natively installed protoc Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants