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

cc_library protoc_lib defines main() #12887

Closed
scotthart opened this issue May 23, 2023 · 2 comments
Closed

cc_library protoc_lib defines main() #12887

scotthart opened this issue May 23, 2023 · 2 comments
Assignees
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days. investigation

Comments

@scotthart
Copy link
Contributor

What version of protobuf and what language are you using?
Version: v23.1
Language: C++

What operating system (Linux, Windows, ...) and version?
Linux ... 6.1.20-2rodete1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.20-2rodete1 (2023-04-21) x86_64 GNU/Linux

What runtime / compiler are you using (e.g., python version or gcc version)
Debian clang version 14.0.6

What did you do?
Steps to reproduce the behavior:
Ran the tests defined in
https://github.com/googleapis/google-cloud-cpp/blob/main/generator/internal/predicate_utils_test.cc
using bazel test

What did you expect to see
Tests executing as they did in protobuf v21.12

What did you see instead?
The usage error from invoking protoc without any arguments.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

gdb home/username/.cache/bazel/_bazel_username/f564c2f714c6826c87550e7c5eec6cf0/execroot/google_cloud_cpp/bazel-out/k8-dbg/bin/generator/internal_predicate_utils_test
GNU gdb (GDB) 10.0-gg5
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-grtev4-linux-gnu".
Type "show configuration" for configuration details.

<http://go/gdb-home FAQ: http://go/gdb-faq Email: c-toolchain-team>
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Reading symbols from home/username/.cache/bazel/_bazel_username/f564c2f714c6826c87550e7c5eec6cf0/execroot/google_cloud_cpp/bazel-out/k8-dbg/bin/generator/internal_predicate_utils_test...
Unable to determine compiler version.
Skipping loading of libstdc++ pretty-printers for now.
Loading libc++ pretty-printers.
Non-google3 binary detected.
(gdb) break CommandLineInterface::PrintHelpText
Function "CommandLineInterface::PrintHelpText" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (CommandLineInterface::PrintHelpText) pending.
(gdb) run
Starting program: home/username/.cache/bazel/_bazel_username/f564c2f714c6826c87550e7c5eec6cf0/execroot/google_cloud_cpp/bazel-out/k8-dbg/bin/generator/internal_predicate_utils_test 
BFD: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
BFD: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
BFD: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
BFD: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
warning: `/lib64/ld-linux-x86-64.so.2': Shared library architecture unknown is not compatible with target architecture i386:x86-64.
warning: `/lib64/ld-linux-x86-64.so.2': Shared library architecture unknown is not compatible with target architecture i386:x86-64.
BFD: /lib/x86_64-linux-gnu/libm.so.6: unknown type [0x13] section `.relr.dyn'
BFD: /lib/x86_64-linux-gnu/libm.so.6: unknown type [0x13] section `.relr.dyn'
BFD: /lib/x86_64-linux-gnu/libm.so.6: unknown type [0x13] section `.relr.dyn'
BFD: /lib/x86_64-linux-gnu/libm.so.6: unknown type [0x13] section `.relr.dyn'
warning: `/lib/x86_64-linux-gnu/libm.so.6': Shared library architecture unknown is not compatible with target architecture i386:x86-64.
BFD: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'
BFD: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'
BFD: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'
BFD: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'
warning: `/lib/x86_64-linux-gnu/libc.so.6': Shared library architecture unknown is not compatible with target architecture i386:x86-64.

Breakpoint 1, 0x00007ffff684c0a0 in google::protobuf::compiler::CommandLineInterface::PrintHelpText()@plt ()
   from home/username/.cache/bazel/_bazel_username/f564c2f714c6826c87550e7c5eec6cf0/execroot/google_cloud_cpp/bazel-out/k8-dbg/bin/generator/../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Slibcommand_Uline_Uinterface.so
(gdb) bt
#0  0x00007ffff684c0a0 in google::protobuf::compiler::CommandLineInterface::PrintHelpText()@plt ()
   from home/username/.cache/bazel/_bazel_username/f564c2f714c6826c87550e7c5eec6cf0/execroot/google_cloud_cpp/bazel-out/k8-dbg/bin/generator/../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Ssrc_Sgoogle_Sprotobuf_Scompiler_Slibcommand_Uline_Uinterface.so
#1  0x00007ffff685ef5b in google::protobuf::compiler::CommandLineInterface::ParseArguments (this=0x7fffffffd520, argc=1, 
    argv=0x7fffffffd8b8) at external/com_google_protobuf/src/google/protobuf/compiler/command_line_interface.cc:1634
#2  0x00007ffff685c52c in google::protobuf::compiler::CommandLineInterface::Run (this=0x7fffffffd520, argc=1, argv=0x7fffffffd8b8)
    at external/com_google_protobuf/src/google/protobuf/compiler/command_line_interface.cc:1107
#3  0x00007ffff7035033 in google::protobuf::compiler::ProtobufMain (argc=1, argv=0x7fffffffd8b8)
    at external/com_google_protobuf/src/google/protobuf/compiler/main.cc:120
#4  0x00007ffff7035635 in main (argc=1, argv=0x7fffffffd8b8) at external/com_google_protobuf/src/google/protobuf/compiler/main.cc:128
#5  0x00007ffff422618a in __libc_start_call_main () at ../sysdeps/nptl/libc_start_call_main.h:58
#6  0x00007ffff4226245 in __libc_start_main_impl (main=<error reading variable: Cannot access memory at address 0xffffd850>, argc=1, 
    argv=0x7fffffffd8b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=<error reading variable: Cannot access memory at address 0xffffd8a0>) at ../csu/libc-start.c:381
#7  0x00005555555648c1 in _start ()
(gdb) 

Anything else we should know about your project / environment
Instead of the main() from gtest_main being executed, the main() from protoc_lib was executed.
I would not expect to find main defined in a cc_library rule.

protobuf/src/google/protobuf/compiler/BUILD.bazel defines:

cc_library(
    name = "protoc_lib",
    srcs = [
        "main.cc",
    ],
    copts = COPTS,
    visibility = [
        "//:__pkg__",
        "//pkg:__pkg__",
    ],
    deps = [
        ":code_generator",
        ":command_line_interface",
        ":importer",
        "//src/google/protobuf:protobuf_nowkt",
        "//src/google/protobuf/compiler/cpp",
        "//src/google/protobuf/compiler/csharp",
        "//src/google/protobuf/compiler/java",
        "//src/google/protobuf/compiler/objectivec",
        "//src/google/protobuf/compiler/php",
        "//src/google/protobuf/compiler/python",
        "//src/google/protobuf/compiler/ruby",
        "//src/google/protobuf/compiler/rust",
        "@com_google_absl//absl/log:initialize",
    ],
)

protobuf/src/google/protobuf/compiler/main.cc defines:

int main(int argc, char* argv[]) {
  return google::protobuf::compiler::ProtobufMain(argc, argv);
}
@scotthart scotthart added the untriaged auto added to all issues by default when created. label May 23, 2023
@hlopko hlopko added investigation and removed untriaged auto added to all issues by default when created. labels May 24, 2023
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Nov 12, 2023
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days. investigation
Projects
None yet
Development

No branches or pull requests

3 participants