Protobuf: make check fails

Created on 6 Nov 2018  Â·  10Comments  Â·  Source: protocolbuffers/protobuf

make check fails on Ubuntu 16.04 with an error that doesn't look terribly serious.

Any idea what could be wrong?

g++ -DHAVE_CONFIG_H -I. -I..    -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wextra -Werror -Wno-unused-parameter -Og -g -std=c++11 -DNDEBUG -MT google/protobuf/no_warning_test-any_test.pb.o -MD -MP -MF google/protobuf/.deps/no_warning_test-any_test.pb.Tpo -c -o google/protobuf/no_warning_test-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo './'`google/protobuf/any_test.pb.cc
google/protobuf/any_test.pb.cc:94:13: error: ‘dynamic_init_dummy_google_2fprotobuf_2fany_5ftest_2eproto’ defined but not used [-Werror=unused-variable]
 static bool dynamic_init_dummy_google_2fprotobuf_2fany_5ftest_2eproto = []() { 
             ^
cc1plus: all warnings being treated as errors

As an aside, my main app is failing to link with many errors like:

/usr/local/include/google/protobuf/arenastring.h:288: undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'

with pkg-config --cflags --libs protobuf giving

-pthread -I/usr/local/include -L/usr/local/lib -lprotobuf -pthread

I don't know if these are related.

autotools

Most helpful comment

workaround for now:

% vi src/Makefile

#remove -Werror from line # 2044 shown below

no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \
                           -Wall -Wextra -Wno-unused-parameter -Og

All 10 comments

Are you mixing C++11 versions by any chance? Starting from version 3.6 we require C++11 and build with -std=c++11, but if your app is being built with C++14, for example, I suspect there may be ABI compatibility issues.

Also failing make check w/the same error.
Environment is a fresh Ubuntu 16.04 vagrant box

google/protobuf/any_test.pb.cc:96:13: error: ‘dynamic_init_dummy_google_2fprotobuf_2fany_5ftest_2eproto’ defined but not used [-Werror=unused-variable]
 static bool dynamic_init_dummy_google_2fprotobuf_2fany_5ftest_2eproto = []() { AddDescriptors_google_2fprotobuf_2fany_5ftest_2eproto(); return true; }();

@will-bastian I think that "defined but not used" message is a harmless warning. Are you building with stricter warning flags than the default?

@acozzette You're correct that's it's a warning. There's an additional prompt stating all warnings are being treated as errors:
cc1plus: all warnings being treated as errors

This was the state w/o making an explicit changes to warning flags.

That's strange, I'm surprised that -Werror is being passed to the compiler.

workaround for now:

% vi src/Makefile

#remove -Werror from line # 2044 shown below

no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \
                           -Wall -Wextra -Wno-unused-parameter -Og

workaround for now:

% vi src/Makefile

remove -Werror from line # 2044 shown below

no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \
                           -Wall -Wextra -Wno-unused-parameter -Og

+1, It works for me

The warning itself might be harmless, but the test that fails to compile is called google/protobuf/no_warning_test-any_test so i guess the check fails for a reason and the -Werror is fully intentional for a "no-warnings-test".

So the actual bug here is the warning itself, not the -Werror.
I'm running latest protobuf release (v3.7.0) on Ubuntu xenial (16.04.5 LTS).

# g++ -dumpversion
5.4.0

Are there plans to fix this? This is causing issues in our builds.
NOTE: We do builds using -O0 (not optimized) with -Werror and that builds fine. For that same build, optimized, using -Ofast, we get the warning. So for now we have to drop the -Werror from our optimized builds but not our non-optimized build.

Hello,

just solved adding "-std=c++11" to CXXFLAGS. There are lots of "note" and "warning" but no errors

CentOS 7 and protobuf 3.11.2

Was this page helpful?
0 / 5 - 0 ratings