-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
//src/google/protobuf/json:parser depends on @com_google_googletest//:gtest_main #11409
Comments
I need more information to help diagnose this. Please fill out our bug template form with how you're building, where you are running this, and the exact error logs you see. In general, we have many other dependencies on gtest_main that we haven't seen any issues with. |
I'm happy to fill out the template if that helps you, but I believe that any library that depends on :gtest_main is a bug (even if it happens to work in some circumstances) since it would include multiple definitions of main during linking. What version of protobuf and what language are you using? What operating system (Linux, Windows, ...) and version? What runtime / compiler are you using (e.g., python version or gcc version) What did you do?
What did you expect to see What did you see instead? Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Success test log (head)
|
In release v3.22.0 (or v4.22.0?) this is causing a build error in the grpc-gateway:
I've worked around it by adding |
…_google_googletest//:gtest_main from //src/google/protobuf/json:parser (protocolbuffers#12267) Downstream bazel projects that depend on protoc would need to provide googletest dependencies when it should not be necessary to do so. Fixes protocolbuffers#11409 Closes protocolbuffers#12267 COPYBARA_INTEGRATE_REVIEW=protocolbuffers#12267 from prestonvanloon:remove-erroneous-googletest-dep 09fd163 PiperOrigin-RevId: 517974450
//src/google/protobuf/json:parser is a library (and transitively included in //:protobuf). This means any attempt to link with //:protobuf brings in an implementation of main which could be called instead of the caller's main.
The chain I see in my local repository (where I'm having the incorrect main called) is
... local dependencies...
@com_google_protobuf//:protobuf
@com_google_protobuf//src/google/protobuf/util:json_util
@com_google_protobuf//src/google/protobuf/json:json
@com_google_protobuf//src/google/protobuf/json:parser
@com_google_googletest//:gtest_main
@com_google_googletest//:googlemock/src/gmock_main.cc
This is the location of the dependency I think is in error: https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/json/BUILD.bazel#L197
The text was updated successfully, but these errors were encountered: