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

Unable to run protoc #5107

Closed
Bidski opened this issue Sep 4, 2018 · 16 comments
Closed

Unable to run protoc #5107

Bidski opened this issue Sep 4, 2018 · 16 comments

Comments

@Bidski
Copy link

Bidski commented Sep 4, 2018

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

What operating system (Linux, Windows, ...) and version?
Linux Mint 18.2

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

What did you do?
Steps to reproduce the behavior:

  1. Download release tarball https://github.com/google/protobuf/releases/download/v3.6.1/protobuf-cpp-3.6.1.tar.gz
  2. Extract
  3. cd protobuf-3.6.1
  4. ./configure
  5. make -j$(nproc)
  6. LD_LIBRARY_PATH=./src/.libs ./src/.libs/protoc --version

What did you expect to see
libprotoc 3.6.1

What did you see instead?
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted

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

Anything else we should know about your project / environment

@acozzette
Copy link
Member

Could you try running make check and see if the tests build and run successfully? If that works then it would also be useful to know if running protoc in gdb gives some more information about where exactly the crash is happening.

@Bidski
Copy link
Author

Bidski commented Sep 4, 2018

Output from make check

Making check in .
make[1]: Entering directory '/home/bidski/Projects/protobuf-3.6.1'
make  check-local
make[2]: Entering directory '/home/bidski/Projects/protobuf-3.6.1'
Making lib/libgmock.a lib/libgmock_main.a in gmock
make[3]: Entering directory '/home/bidski/Projects/protobuf-3.6.1/third_party/googletest/googletest'
depbase=`echo src/gtest-all.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I./build-aux  -I. -I./include  -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gtest-all.lo -MD -MP -MF $depbase.Tpo -c -o src/gtest-all.lo src/gtest-all.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I. -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gtest-all.lo -MD -MP -MF src/.deps/gtest-all.Tpo -c src/gtest-all.cc  -fPIC -DPIC -o src/.libs/gtest-all.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I. -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gtest-all.lo -MD -MP -MF src/.deps/gtest-all.Tpo -c src/gtest-all.cc -o src/gtest-all.o >/dev/null 2>&1
/bin/bash ./libtool  --tag=CXX   --mode=link g++ -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG   -o lib/libgtest.la -rpath /usr/local/lib src/gtest-all.lo  
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o  src/.libs/gtest-all.o   -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o  -pthread -g   -pthread -Wl,-soname -Wl,libgtest.so.0 -o lib/.libs/libgtest.so.0.0.0
libtool: link: (cd "lib/.libs" && rm -f "libgtest.so.0" && ln -s "libgtest.so.0.0.0" "libgtest.so.0")
libtool: link: (cd "lib/.libs" && rm -f "libgtest.so" && ln -s "libgtest.so.0.0.0" "libgtest.so")
libtool: link: ar cru lib/.libs/libgtest.a  src/gtest-all.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib lib/.libs/libgtest.a
libtool: link: ( cd "lib/.libs" && rm -f "libgtest.la" && ln -s "../libgtest.la" "libgtest.la" )
depbase=`echo src/gtest_main.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I./build-aux  -I. -I./include  -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gtest_main.lo -MD -MP -MF $depbase.Tpo -c -o src/gtest_main.lo src/gtest_main.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I. -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gtest_main.lo -MD -MP -MF src/.deps/gtest_main.Tpo -c src/gtest_main.cc  -fPIC -DPIC -o src/.libs/gtest_main.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I. -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gtest_main.lo -MD -MP -MF src/.deps/gtest_main.Tpo -c src/gtest_main.cc -o src/gtest_main.o >/dev/null 2>&1
/bin/bash ./libtool  --tag=CXX   --mode=link g++ -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG   -o lib/libgtest_main.la -rpath /usr/local/lib src/gtest_main.lo lib/libgtest.la 
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o  src/.libs/gtest_main.o   -Wl,-rpath -Wl,/home/bidski/Projects/protobuf-3.6.1/third_party/googletest/googletest/lib/.libs lib/.libs/libgtest.so -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o  -pthread -g   -pthread -Wl,-soname -Wl,libgtest_main.so.0 -o lib/.libs/libgtest_main.so.0.0.0
libtool: link: (cd "lib/.libs" && rm -f "libgtest_main.so.0" && ln -s "libgtest_main.so.0.0.0" "libgtest_main.so.0")
libtool: link: (cd "lib/.libs" && rm -f "libgtest_main.so" && ln -s "libgtest_main.so.0.0.0" "libgtest_main.so")
libtool: link: ar cru lib/.libs/libgtest_main.a  src/gtest_main.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib lib/.libs/libgtest_main.a
libtool: link: ( cd "lib/.libs" && rm -f "libgtest_main.la" && ln -s "../libgtest_main.la" "libgtest_main.la" )
make[3]: Leaving directory '/home/bidski/Projects/protobuf-3.6.1/third_party/googletest/googletest'
make[3]: Entering directory '/home/bidski/Projects/protobuf-3.6.1/third_party/googletest/googlemock'
depbase=`echo src/gmock-all.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I./build-aux  -I./../googletest/include -I./include  -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gmock-all.lo -MD -MP -MF $depbase.Tpo -c -o src/gmock-all.lo src/gmock-all.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I./../googletest/include -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gmock-all.lo -MD -MP -MF src/.deps/gmock-all.Tpo -c src/gmock-all.cc  -fPIC -DPIC -o src/.libs/gmock-all.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I./../googletest/include -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gmock-all.lo -MD -MP -MF src/.deps/gmock-all.Tpo -c src/gmock-all.cc -o src/gmock-all.o >/dev/null 2>&1
/bin/bash ./libtool  --tag=CXX   --mode=link g++ -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG   -o lib/libgmock.la -rpath /usr/local/lib src/gmock-all.lo  
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o  src/.libs/gmock-all.o   -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o  -pthread -g   -pthread -Wl,-soname -Wl,libgmock.so.0 -o lib/.libs/libgmock.so.0.0.0
libtool: link: (cd "lib/.libs" && rm -f "libgmock.so.0" && ln -s "libgmock.so.0.0.0" "libgmock.so.0")
libtool: link: (cd "lib/.libs" && rm -f "libgmock.so" && ln -s "libgmock.so.0.0.0" "libgmock.so")
libtool: link: ar cru lib/.libs/libgmock.a  src/gmock-all.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib lib/.libs/libgmock.a
libtool: link: ( cd "lib/.libs" && rm -f "libgmock.la" && ln -s "../libgmock.la" "libgmock.la" )
depbase=`echo src/gmock_main.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I./build-aux  -I./../googletest/include -I./include  -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gmock_main.lo -MD -MP -MF $depbase.Tpo -c -o src/gmock_main.lo src/gmock_main.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I./../googletest/include -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gmock_main.lo -MD -MP -MF src/.deps/gmock_main.Tpo -c src/gmock_main.cc  -fPIC -DPIC -o src/.libs/gmock_main.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I./../googletest/include -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG -MT src/gmock_main.lo -MD -MP -MF src/.deps/gmock_main.Tpo -c src/gmock_main.cc -o src/gmock_main.o >/dev/null 2>&1
/bin/bash ./libtool  --tag=CXX   --mode=link g++ -pthread -DGTEST_HAS_PTHREAD=1 -g -std=c++11 -DNDEBUG   -o lib/libgmock_main.la -rpath /usr/local/lib src/gmock_main.lo lib/libgmock.la 
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o  src/.libs/gmock_main.o   -Wl,-rpath -Wl,/home/bidski/Projects/protobuf-3.6.1/third_party/googletest/googlemock/lib/.libs lib/.libs/libgmock.so -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o  -pthread -g   -pthread -Wl,-soname -Wl,libgmock_main.so.0 -o lib/.libs/libgmock_main.so.0.0.0
libtool: link: (cd "lib/.libs" && rm -f "libgmock_main.so.0" && ln -s "libgmock_main.so.0.0.0" "libgmock_main.so.0")
libtool: link: (cd "lib/.libs" && rm -f "libgmock_main.so" && ln -s "libgmock_main.so.0.0.0" "libgmock_main.so")
libtool: link: ar cru lib/.libs/libgmock_main.a  src/gmock_main.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib lib/.libs/libgmock_main.a
libtool: link: ( cd "lib/.libs" && rm -f "libgmock_main.la" && ln -s "../libgmock_main.la" "libgmock_main.la" )
make[3]: Leaving directory '/home/bidski/Projects/protobuf-3.6.1/third_party/googletest/googlemock'
make[2]: Leaving directory '/home/bidski/Projects/protobuf-3.6.1'
make[1]: Leaving directory '/home/bidski/Projects/protobuf-3.6.1'
Making check in src
make[1]: Entering directory '/home/bidski/Projects/protobuf-3.6.1/src'
make  protoc protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test test_plugin protobuf-lite-arena-test no-warning-test zcgzip zcgunzip
make[2]: Entering directory '/home/bidski/Projects/protobuf-3.6.1/src'
make[2]: 'protoc' is up to date.
oldpwd=`pwd` && ( cd . && $oldpwd/protoc -I. --cpp_out=$oldpwd google/protobuf/any_test.proto google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto google/protobuf/map_lite_unittest.proto google/protobuf/map_proto2_unittest.proto google/protobuf/map_unittest.proto google/protobuf/unittest_arena.proto google/protobuf/unittest_custom_options.proto google/protobuf/unittest_drop_unknown_fields.proto google/protobuf/unittest_embed_optimize_for.proto google/protobuf/unittest_empty.proto google/protobuf/unittest_enormous_descriptor.proto google/protobuf/unittest_import_lite.proto google/protobuf/unittest_import.proto google/protobuf/unittest_import_public_lite.proto google/protobuf/unittest_import_public.proto google/protobuf/unittest_lazy_dependencies.proto google/protobuf/unittest_lazy_dependencies_custom_option.proto google/protobuf/unittest_lazy_dependencies_enum.proto google/protobuf/unittest_lite_imports_nonlite.proto google/protobuf/unittest_lite.proto google/protobuf/unittest_mset.proto google/protobuf/unittest_mset_wire_format.proto google/protobuf/unittest_no_arena_lite.proto google/protobuf/unittest_no_arena_import.proto google/protobuf/unittest_no_arena.proto google/protobuf/unittest_no_field_presence.proto google/protobuf/unittest_no_generic_services.proto google/protobuf/unittest_optimize_for.proto google/protobuf/unittest_preserve_unknown_enum2.proto google/protobuf/unittest_preserve_unknown_enum.proto google/protobuf/unittest.proto google/protobuf/unittest_proto3_arena.proto google/protobuf/unittest_proto3_arena_lite.proto google/protobuf/unittest_proto3_lite.proto google/protobuf/unittest_well_known_types.proto google/protobuf/util/internal/testdata/anys.proto google/protobuf/util/internal/testdata/books.proto google/protobuf/util/internal/testdata/default_value.proto google/protobuf/util/internal/testdata/default_value_test.proto google/protobuf/util/internal/testdata/field_mask.proto google/protobuf/util/internal/testdata/maps.proto google/protobuf/util/internal/testdata/oneofs.proto google/protobuf/util/internal/testdata/proto3.proto google/protobuf/util/internal/testdata/struct.proto google/protobuf/util/internal/testdata/timestamp_duration.proto google/protobuf/util/internal/testdata/wrappers.proto google/protobuf/util/json_format_proto3.proto google/protobuf/util/message_differencer_unittest.proto google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto )
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
/bin/bash: line 1:  2463 Aborted                 $oldpwd/protoc -I. --cpp_out=$oldpwd google/protobuf/any_test.proto google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto google/protobuf/map_lite_unittest.proto google/protobuf/map_proto2_unittest.proto google/protobuf/map_unittest.proto google/protobuf/unittest_arena.proto google/protobuf/unittest_custom_options.proto google/protobuf/unittest_drop_unknown_fields.proto google/protobuf/unittest_embed_optimize_for.proto google/protobuf/unittest_empty.proto google/protobuf/unittest_enormous_descriptor.proto google/protobuf/unittest_import_lite.proto google/protobuf/unittest_import.proto google/protobuf/unittest_import_public_lite.proto google/protobuf/unittest_import_public.proto google/protobuf/unittest_lazy_dependencies.proto google/protobuf/unittest_lazy_dependencies_custom_option.proto google/protobuf/unittest_lazy_dependencies_enum.proto google/protobuf/unittest_lite_imports_nonlite.proto google/protobuf/unittest_lite.proto google/protobuf/unittest_mset.proto google/protobuf/unittest_mset_wire_format.proto google/protobuf/unittest_no_arena_lite.proto google/protobuf/unittest_no_arena_import.proto google/protobuf/unittest_no_arena.proto google/protobuf/unittest_no_field_presence.proto google/protobuf/unittest_no_generic_services.proto google/protobuf/unittest_optimize_for.proto google/protobuf/unittest_preserve_unknown_enum2.proto google/protobuf/unittest_preserve_unknown_enum.proto google/protobuf/unittest.proto google/protobuf/unittest_proto3_arena.proto google/protobuf/unittest_proto3_arena_lite.proto google/protobuf/unittest_proto3_lite.proto google/protobuf/unittest_well_known_types.proto google/protobuf/util/internal/testdata/anys.proto google/protobuf/util/internal/testdata/books.proto google/protobuf/util/internal/testdata/default_value.proto google/protobuf/util/internal/testdata/default_value_test.proto google/protobuf/util/internal/testdata/field_mask.proto google/protobuf/util/internal/testdata/maps.proto google/protobuf/util/internal/testdata/oneofs.proto google/protobuf/util/internal/testdata/proto3.proto google/protobuf/util/internal/testdata/struct.proto google/protobuf/util/internal/testdata/timestamp_duration.proto google/protobuf/util/internal/testdata/wrappers.proto google/protobuf/util/json_format_proto3.proto google/protobuf/util/message_differencer_unittest.proto google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto
Makefile:8021: recipe for target 'unittest_proto_middleman' failed
make[2]: *** [unittest_proto_middleman] Error 134
make[2]: Leaving directory '/home/bidski/Projects/protobuf-3.6.1/src'
Makefile:7833: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/bidski/Projects/protobuf-3.6.1/src'
Makefile:1538: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

Running gdb protoc (release build) produces nothing of much use.

Starting program: /home/bidski/Projects/protobuf-3.6.1/src/.libs/protoc 
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1

Program received signal SIGABRT, Aborted.
0x00007ffff7241428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7241428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff724302a in __GI_abort () at abort.c:89
#2  0x00007ffff787a8f7 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff7880a46 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff7880a81 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff7880cb4 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff787c9b9 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff707cd59 in std::call_once<void (&)()> (__once=..., __f=<optimised out>) at /usr/include/c++/7/mutex:698
#8  0x00007ffff7de76ba in call_init (l=<optimised out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffda48, env=env@entry=0x7fffffffda58) at dl-init.c:72
#9  0x00007ffff7de77cb in call_init (env=0x7fffffffda58, argv=0x7fffffffda48, argc=1, l=<optimised out>) at dl-init.c:30
#10 _dl_init (main_map=0x7ffff7ffe168, argc=1, argv=0x7fffffffda48, env=0x7fffffffda58) at dl-init.c:120
#11 0x00007ffff7dd7c6a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#12 0x0000000000000001 in ?? ()
#13 0x00007fffffffde3a in ?? ()
#14 0x0000000000000000 in ?? ()
(gdb) quit

Running gdb protoc (debug build) produces

Starting program: /home/bidski/Projects/protobuf-3.6.1/src/.libs/protoc 
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1

Program received signal SIGABRT, Aborted.
0x00007ffff70e7428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff70e7428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff70e902a in __GI_abort () at abort.c:89
#2  0x00007ffff77208f7 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff7726a46 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff7726a81 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff7726cb4 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff77229b9 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff7bca0c4 in std::call_once<void (&)()> (__once=..., __f=@0x7ffff6dbc8f8: {void (void)} 0x7ffff6dbc8f8 <protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptorsImpl()>) at /usr/include/c++/7/mutex:698
#8  0x00007ffff7bc912a in google::protobuf::internal::call_once<std::once_flag&, void (&)()> (args#0=..., args#1=@0x7ffff6dbc8f8: {void (void)} 0x7ffff6dbc8f8 <protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptorsImpl()>)
    at ./google/protobuf/stubs/once.h:91
#9  0x00007ffff6dbc945 in protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors () at google/protobuf/any.pb.cc:105
#10 0x00007ffff6dbe913 in protobuf_google_2fprotobuf_2fany_2eproto::StaticDescriptorInitializer::StaticDescriptorInitializer (this=0x7ffff70b0550 <protobuf_google_2fprotobuf_2fany_2eproto::static_descriptor_initializer>)
    at google/protobuf/any.pb.cc:110
#11 0x00007ffff6dbdf11 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at google/protobuf/any.pb.cc:112
#12 0x00007ffff6dbdf27 in _GLOBAL__sub_I_any.pb.cc(void) () at google/protobuf/any.pb.cc:433
#13 0x00007ffff7de76ba in call_init (l=<optimised out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffda48, env=env@entry=0x7fffffffda58) at dl-init.c:72
#14 0x00007ffff7de77cb in call_init (env=0x7fffffffda58, argv=0x7fffffffda48, argc=1, l=<optimised out>) at dl-init.c:30
#15 _dl_init (main_map=0x7ffff7ffe168, argc=1, argv=0x7fffffffda48, env=0x7fffffffda58) at dl-init.c:120
#16 0x00007ffff7dd7c6a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#17 0x0000000000000001 in ?? ()
#18 0x00007fffffffde3a in ?? ()
#19 0x0000000000000000 in ?? ()
(gdb) quit

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 6, 2018

@Bidski Is "Linux Mint" something that can be ran inside docker? If so could you help create a docker image that we can run to reproduce the issue?

@Bidski
Copy link
Author

Bidski commented Sep 6, 2018

@xfxyjwf "Linux MInt 18.2" is little more than "Ubuntu Xenial". I am unable to create a docker container to reproduce this. Are there any further tests that I can run to help diagnose this issue?

@acozzette
Copy link
Member

The output from gdb makes it look like the problem has something to do with our dynamic initialization code. That code seems to have a habit of exposing weird compiler bugs and quirks. @gerben-s Do you have any ideas what could be going wrong?

@Bidski As one more test could you try building protoc from the latest code on the master branch and see if you get the same problem? I see that the related code has already changed a fair amount since the 3.6.1 release.

@Bidski
Copy link
Author

Bidski commented Sep 6, 2018

@acozzette the master branch fails to compile at all for me. I get this error from make

/bin/bash ../libtool  --tag=CXX   --mode=link g++ -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -O2 -g -std=c++11 -DNDEBUG -pthread  -o protoc google/protobuf/compiler/main.o  libprotobuf.la libprotoc.la -lz 
libtool: link: g++ -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -O2 -g -std=c++11 -DNDEBUG -pthread -o .libs/protoc google/protobuf/compiler/main.o  ./.libs/libprotobuf.so ./.libs/libprotoc.so -lz -pthread
./.libs/libprotoc.so: error: undefined reference to 'scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto'
collect2: error: ld returned 1 exit status
Makefile:3501: recipe for target 'protoc' failed
make[2]: *** [protoc] Error 1

@Bidski
Copy link
Author

Bidski commented Sep 7, 2018

@acozzette the 3.6.x branch fails in the same way that the 3.6.1 release tarball does

@Bidski
Copy link
Author

Bidski commented Sep 19, 2018

@acozzette any update on this? Is there some other diagnostic I can perform to gather more information?

@Bidski
Copy link
Author

Bidski commented Sep 19, 2018

Figured I would try the cmake build system (although you market it as only being for building on windows?).

Using the 3.6.1 tarball and the master branch, cmake (and ninja) successfully builds protoc and running protoc --version I get the expected libprotoc 3.6.1 output.

On the 3.6.x branch cmake a small patch is needed to cmake/protoc.cmake to allow cmake to finish configuring, but otherwise this branch also compiles and runs successfully.

Why would the cmake build be successful where the autotools build is not?

@acozzette
Copy link
Member

@Bidski That is interesting and I can't think of why it would work with cmake but not the autotools build. Unfortunately I don't really have time to look into this now but if cmake works then that may be the best workaround. We are considering deprecating the autools build in favor of cmake soon anyway.

@Arfrever
Copy link
Contributor

Arfrever commented May 8, 2019

The problem .libs/libprotoc.so: error: undefined reference to 'scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto' is caused by this bug in linker GOLD:
https://sourceware.org/bugzilla/show_bug.cgi?id=24527

Autotools build system uses version scripts (src/libprotobuf.map, src/libprotobuf-lite.map, src/libprotoc.map) which trigger this bug in linker GOLD, but cmake build system does not use them:

$ grep -r -- --version-script *
configure.ac:LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
src/Makefile.am:libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map
src/Makefile.am:libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map
src/Makefile.am:libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map

(Issue #6113 for this difference between build systems.)

@filimonov
Copy link

About the original issue - I've faced the same (ClickHouse/ClickHouse#7114 ). It looks like it happens when pthread is not linked to protoc.

Most probably relates to:

@Omcsesz
Copy link

Omcsesz commented Apr 24, 2020

I recommend the addition of linux label.

lipnitsk added a commit to protobuf-c/protobuf-c that referenced this issue May 9, 2020
-lpthread was missing from the linker command line. See
protocolbuffers/protobuf#5107 for more
details.

.travis.yml: Run CMake debug build for verification
lipnitsk added a commit to protobuf-c/protobuf-c that referenced this issue May 9, 2020
-lpthread was missing from the linker command line. See
protocolbuffers/protobuf#5107 for more
details.

.travis.yml: Run CMake debug build for verification
lipnitsk added a commit to protobuf-c/protobuf-c that referenced this issue May 9, 2020
-lpthread was missing from the linker command line. See
protocolbuffers/protobuf#5107 for more
details.

.travis.yml: Run CMake debug build for verification
lipnitsk added a commit to protobuf-c/protobuf-c that referenced this issue May 9, 2020
-lpthread was missing from the linker command line. See
protocolbuffers/protobuf#5107 for more
details.

.travis.yml: Run CMake debug build for verification
@paragikjain
Copy link

I am facing same issue . Any Updates on this issue??

@paragikjain
Copy link

For cross-compiling, you can specify an protoc binary using
the "--with-protoc" flag. That is:
./configure --with-protoc=/path/to/cygwin/protoc --host=i686-w64-mingw32

this will resolve the issue

@fowles
Copy link
Contributor

fowles commented Jul 1, 2022

Closing out old issues. Please reopen if this still occurs on recent releases.

@fowles fowles closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants