This might fix the new CI build failure:
→ Run ./autogen.sh
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory build-aux
autoreconf: configure.ac: not using Libtool
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /opt/homebrew/Cellar/autoconf/2.72/bin/autoconf --force
autoreconf: running: /opt/homebrew/Cellar/autoconf/2.72/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:14: installing 'build-aux/compile'
configure.ac:13: installing 'build-aux/install-sh'
configure.ac:13: installing 'build-aux/missing'
Makefile.am:4: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:4: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:4: to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:4: If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:4: its definition is in aclocal's search path.
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
autoreconf: error: automake failed with exit status: 1
cxx-generate-packed-data needs to link with protobuf library for the C++
source file.
Use the protobuf::libprotobuf to get both library and include directory.
Signed-off-by: Clément Péron <peron.clem@gmail.com>
PROTOBUF_PROTOC_EXECUTABLE is not set in the Protobuf CMake config file.
Set it properly in case we use CMake protobuf config file.
Signed-off-by: Clément Péron <peron.clem@gmail.com>
APT cache could be out of date leading to a:
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Fix this by always calling apt-get update before an apt-get install.
Signed-off-by: Clément Péron <peron.clem@gmail.com>
The CMake module is used by default but isn't compatible with
recent protobuf version.
Try to first look for a protobuf config then fallback to legacy
cmake module.
Signed-off-by: Clément Péron <peron.clem@gmail.com>
A memory corruption in protobuf_c_message_free_unpacked happens at the
following line:
if (message->unknown_fields != NULL)
do_free(allocator, message->unknown_fields);
The do_free will free ->unknown_fields. This is may be wrong, because
protobuf_c_message_unpack uses malloc as the default allocator, allocates
rv with malloc. At the end, however, ->unknown_fields is only initialized
if there are some. That means if there are no such fields ->unknown_fields
is an uninitialized pointer.
The patch initializes the pointer to NULL to ensure the check before free
is performed on initialized memory in case there is no unknown_field.
This fixes https://github.com/protobuf-c/protobuf-c/issues/690
Signed-off-by: Stephan Mueller <smueller@chronox.de>
This file uses declarations after statements and fixing it would make
the code less readable, so silence this particular diagnostic in this
particular file.
Since we now require protobuf >= 3.0.0, we don't have to support older
protobuf versions that don't recognize the `syntax` syntax, so we can
put `syntax = "proto2";` on these proto files to silence the protoc
compiler's diagnostic "No syntax specified for the proto file".
Now that we require protobuf >= 3.0.0, we are always building with
proto3 syntax support.
Note that the test-generated-code3 test keeps `-DPROTO3` which is
separate from the HAVE_PROTO3 identifier. This test is building built
from the same source file as test-generated-code but the source file
supports proto2 and proto3 syntax depending on how it's compiled.
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
[edmonds: From https://github.com/protobuf-c/protobuf-c/pull/523.]
[edmonds: Adjust find string from "0 |" to "0 | ", test against `== 0`
rather than `!= std::string::npos` so that the find/erase calls are
anchored to the same portion of the string.]
This commit updates a few tests where we aren't using the correct C
signature for main() or are not using any of its parameters (in the
case of t/version/version.c.)
This commit fixes the following compiler diagnostics:
../protoc-c/c_helpers.cc: In function ‘void google::protobuf::compiler::c::PrintComment(google::protobuf::io::Printer*, std::__cxx11::string)’:
../protoc-c/c_helpers.cc:221:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::__cxx11::basic_string<char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
for (int i = 0; i < comment_lines.size(); i++)
~~^~~~~~~~~~~~~~~~~~~~~~
../protoc-c/c_helpers.cc: In function ‘std::set<std::__cxx11::basic_string<char> > google::protobuf::compiler::c::MakeKeywordsMap()’:
../protoc-c/c_helpers.cc:273:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
for (int i = 0; i < GOOGLE_ARRAYSIZE(kKeywordList); i++) {
^
There are some recent reports of strange build failures that might have
been fixed by compiling in C++17 mode, so it might be a good idea to use
C++17 in general, and not just when building against very recent
protobuf versions.
Since it looks like we've lost protobuf < 3.0.0 support, configure.ac
can be simplified a bit if we just use C++17 by default.