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

gcc + USE_UNWIND=0 broken (cant run protoc) #7114

Closed
proller opened this issue Sep 26, 2019 · 2 comments
Closed

gcc + USE_UNWIND=0 broken (cant run protoc) #7114

proller opened this issue Sep 26, 2019 · 2 comments
Assignees
Labels
alternative build build minor Priority: minor st-declined The feature will not be implemented. Check the comments.

Comments

@proller
Copy link
Contributor

proller commented Sep 26, 2019

Problem:
[2206/3808] Generating orc_proto.pb.h, orc_proto.pb.cc
FAILED: contrib/arrow-cmake/orc_proto.pb.h contrib/arrow-cmake/orc_proto.pb.cc
cd /build/clickhouse-19.16.1/obj-x86_64-linux-gnu/contrib/arrow-cmake && /build/clickhouse-19.16.1/obj-x86_64-linux-gnu/contrib/protobuf/cmake/protoc -I /build/clickhouse-19.16.1/contrib/orc/c++/../proto --cpp_out="/build/clickhouse-19.16.1/obj-x86_64-linux-gnu/contrib/arrow-cmake" /build/clickhouse-19.16.1/contrib/orc/c++/../proto/orc_proto.proto
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted

Reproduce:
env CMAKE_FLAGS="-DUSE_UNWIND=0" ./release

@proller proller added the build label Sep 26, 2019
@alexey-milovidov alexey-milovidov added the st-declined The feature will not be implemented. Check the comments. label Nov 11, 2019
@filimonov
Copy link
Contributor

cd /home/mfilimonov/workspace/ClickHouse/build-vscode/Debug/contrib/libhdfs3-cmake && gdb --args /home/mfilimonov/workspace/ClickHouse/build-vscode/Debug/contrib/protobuf/cmake/protoc --cpp_out /home/mfilimonov/workspace/ClickHouse/build-vscode/Debug/contrib/libhdfs3-cmake -I /home/mfilimonov/workspace/ClickHouse/contrib/libhdfs3/src/proto /home/mfilimonov/workspace/ClickHouse/contrib/libhdfs3/src/proto/hdfs.proto
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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/mfilimonov/workspace/ClickHouse/build-vscode/Debug/contrib/protobuf/cmake/protoc...done.
(gdb) run
Starting program: /home/mfilimonov/workspace/ClickHouse/build-vscode/Debug/contrib/protobuf/cmake/protoc --cpp_out /home/mfilimonov/workspace/ClickHouse/build-vscode/Debug/contrib/libhdfs3-cmake -I /home/mfilimonov/workspace/ClickHouse/contrib/libhdfs3/src/proto /home/mfilimonov/workspace/ClickHouse/contrib/libhdfs3/src/proto/hdfs.proto
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff7a24801 in __GI_abort () at abort.c:79
#2  0x00005555558e0042 in __gnu_cxx::__verbose_terminate_handler() [clone .cold] ()
#3  0x0000555555b95c16 in __cxxabiv1::__terminate(void (*)()) ()
#4  0x0000555555b95c81 in std::terminate() ()
#5  0x0000555555b95dd5 in __cxa_throw ()
#6  0x00005555558e17b8 in std::__throw_system_error(int) ()
#7  0x0000555555963195 in std::call_once<void (&)()> (__once=..., __f=@0x55555595a4c6: {void (void)} 0x55555595a4c6 <protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::AddDescriptorsImpl()>)
    at /usr/include/c++/9/mutex:697
#8  0x0000555555961f34 in google::protobuf::internal::call_once<std::once_flag&, void (&)()> () at ../../contrib/protobuf/src/google/protobuf/stubs/once.h:91
#9  0x000055555595a512 in protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::AddDescriptors () at ../../contrib/protobuf/src/google/protobuf/compiler/plugin.pb.cc:233
#10 0x00005555559619ff in protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::StaticDescriptorInitializer::StaticDescriptorInitializer (
    this=0x555555df3fc0 <protobuf_google_2fprotobuf_2fcompiler_2fplugin_2eproto::static_descriptor_initializer>) at ../../contrib/protobuf/src/google/protobuf/compiler/plugin.pb.cc:238
#11 0x0000555555960420 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at ../../contrib/protobuf/src/google/protobuf/compiler/plugin.pb.cc:240
#12 0x0000555555960436 in _GLOBAL__sub_I__ZN6google8protobuf8compiler26_Version_default_instance_E () at ../../contrib/protobuf/src/google/protobuf/compiler/plugin.pb.cc:1718
#13 0x0000555555c4614d in __libc_csu_init ()
#14 0x00007ffff7a05b28 in __libc_start_main (main=0x5555558e29c5 <main(int, char**)>, argc=6, argv=0x7fffffffdd38, init=0x555555c46100 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffdd28) at ../csu/libc-start.c:266

@filimonov
Copy link
Contributor

filimonov commented Nov 20, 2019

It seems like the reason is pthread is not linked into protoc directly, and protoc works only when one of the libraries it links (for example libunwind) requires pthread.

That dirty hack fixes the gcc-9 build:

  diff --git a/cmake/protoc.cmake b/cmake/protoc.cmake
index 5777b16..49aa106 100644
--- a/cmake/protoc.cmake
+++ b/cmake/protoc.cmake
@@ -3,5 +3,5 @@ set(protoc_files
 )
 
 add_executable(protoc ${protoc_files})
-target_link_libraries(protoc libprotobuf libprotoc)
+target_link_libraries(protoc libprotobuf libprotoc pthread)
 add_executable(protobuf::protoc ALIAS protoc)

Most probably related to:

filimonov added a commit to filimonov/protobuf that referenced this issue Nov 20, 2019
filimonov added a commit to filimonov/ClickHouse that referenced this issue Nov 20, 2019
vitlibar pushed a commit to ClickHouse/protobuf that referenced this issue Sep 23, 2020
vitlibar pushed a commit to ClickHouse/protobuf that referenced this issue Nov 12, 2020
qoega pushed a commit to ClickHouse/protobuf that referenced this issue Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alternative build build minor Priority: minor st-declined The feature will not be implemented. Check the comments.
Projects
None yet
Development

No branches or pull requests

4 participants