Coder Social home page Coder Social logo

squidfunk / protobluff Goto Github PK

View Code? Open in Web Editor NEW
83.0 83.0 18.0 1.25 MB

A modular Protocol Buffers implementation for C

Home Page: https://squidfunk.github.io/protobluff/

License: MIT License

Shell 0.40% C 79.93% C++ 14.25% CSS 0.55% GDB 0.11% Makefile 4.14% M4 0.62%
lightweight protocol-buffers

protobluff's People

Contributors

christoph-heiss avatar pperisin avatar squidfunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

protobluff's Issues

Differences between lite and full runtime libraries?

I saw the documentation describing the differences, but I don't see how the generated lite and full runtime libraries are at all different. Searching "lite" on this repository doesn't really give any functional differences other than not generating accessors with protoc. Is there something I'm missing here?

Compilation Mistake

Hello I have a problem with the compilation I have double check that the dependence is installed, I am running Linux Debian 11 5.10.0-8-amd64

./autogen.sh && ./configure && make && make test && make install autoreconf: Entering directory .'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:35: installing './compile'
configure.ac:28: installing './missing'
examples/decoding/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C preprocessor... gcc -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for gawk... (cached) gawk
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for main in -lprotobuf... yes
checking for main in -lprotoc... yes
checking for protoc... protoc
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for check >= 0.9.10... no
configure: WARNING: check not found; cannot build tests
checking for lcov... lcov
checking for genhtml... genhtml
checking for valgrind... valgrind
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for inline... inline
checking for size_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for uint8_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for ptrdiff_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for working strtod... yes
checking for localeconv... yes
checking for memmove... yes
checking for setlocale... yes
checking for strchr... yes
checking for strpbrk... yes
checking for strtol... yes
checking for strtoul... yes
checking for strtoull... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating examples/decoding/Makefile
config.status: creating examples/encoding/Makefile
config.status: creating examples/messages/Makefile
config.status: creating examples/Makefile
config.status: creating include/Makefile
config.status: creating src/core/Makefile
config.status: creating src/generator/Makefile
config.status: creating src/message/Makefile
config.status: creating src/util/Makefile
config.status: creating src/Makefile
config.status: creating src/protobluff-lite.pc
config.status: creating src/protobluff.pc
config.status: creating tests/core/buffer/Makefile
config.status: creating tests/core/decoder/Makefile
config.status: creating tests/core/descriptor/Makefile
config.status: creating tests/core/encoder/Makefile
config.status: creating tests/core/stream/Makefile
config.status: creating tests/core/varint/Makefile
config.status: creating tests/core/Makefile
config.status: creating tests/message/buffer/Makefile
config.status: creating tests/message/cursor/Makefile
config.status: creating tests/message/field/Makefile
config.status: creating tests/message/journal/Makefile
config.status: creating tests/message/message/Makefile
config.status: creating tests/message/nested/Makefile
config.status: creating tests/message/oneof/Makefile
config.status: creating tests/message/part/Makefile
config.status: creating tests/message/Makefile
config.status: creating tests/util/chunk_allocator/Makefile
config.status: creating tests/util/descriptor/Makefile
config.status: creating tests/util/validator/Makefile
config.status: creating tests/util/Makefile
config.status: creating tests/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

protobluff 1.1.1

CC:                     gcc
CFLAGS:                  -std=c99 -O3 -DNDEBUG -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -fomit-frame-pointer
CXX:                    g++
CXXFLAGS:                -std=c++11 -O3 -DNDEBUG -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -fomit-frame-pointer
CPPFLAGS:                -Wall -Wno-deprecated-declarations -Wno-address 
LDFLAGS:                 

prefix:                 /usr/local
sysconfdir:             ${prefix}/etc
libdir:                 ${exec_prefix}/lib
includedir:             ${prefix}/include

make all-recursive
make[1]: Entering directory '/home/borbon/Repositories/protobluff'
Making all in include
make[2]: Entering directory '/home/borbon/Repositories/protobluff/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/include'
Making all in src
make[2]: Entering directory '/home/borbon/Repositories/protobluff/src'
Making all in core
make[3]: Entering directory '/home/borbon/Repositories/protobluff/src/core'
CC libprotobluff_core_la-allocator.lo
CC libprotobluff_core_la-buffer.lo
CC libprotobluff_core_la-decoder.lo
CC libprotobluff_core_la-descriptor.lo
CC libprotobluff_core_la-encoder.lo
CC libprotobluff_core_la-stream.lo
CC libprotobluff_core_la-varint.lo
CCLD libprotobluff-core.la
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/src/core'
Making all in message
make[3]: Entering directory '/home/borbon/Repositories/protobluff/src/message'
CC libprotobluff_message_la-buffer.lo
CC libprotobluff_message_la-common.lo
CC libprotobluff_message_la-cursor.lo
CC libprotobluff_message_la-field.lo
CC libprotobluff_message_la-journal.lo
CC libprotobluff_message_la-message.lo
CC libprotobluff_message_la-nested.lo
CC libprotobluff_message_la-oneof.lo
CC libprotobluff_message_la-part.lo
CCLD libprotobluff-message.la
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/src/message'
Making all in util
make[3]: Entering directory '/home/borbon/Repositories/protobluff/src/util'
CC libprotobluff_util_la-chunk_allocator.lo
CC libprotobluff_util_la-descriptor.lo
CC libprotobluff_util_la-validator.lo
CCLD libprotobluff-util.la
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/src/util'
Making all in generator
make[3]: Entering directory '/home/borbon/Repositories/protobluff/src/generator'
CXX protoc_gen_protobluff-enum.o
CXX protoc_gen_protobluff-enum_value.o
CXX protoc_gen_protobluff-extension.o
CXX protoc_gen_protobluff-field.o
CXX protoc_gen_protobluff-file.o
CXX protoc_gen_protobluff-generator.o
CXX protoc_gen_protobluff-message.o
CXX protoc_gen_protobluff-oneof.o
CXX protoc_gen_protobluff-protoc-gen-protobluff.o
CXX protoc_gen_protobluff-strutil.o
CXXLD protoc-gen-protobluff
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/src/generator'
make[3]: Entering directory '/home/borbon/Repositories/protobluff/src'
CCLD libprotobluff-lite.la
CCLD libprotobluff.la
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/src'
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/src'
Making all in tests
make[2]: Entering directory '/home/borbon/Repositories/protobluff/tests'
Making all in core
make[3]: Entering directory '/home/borbon/Repositories/protobluff/tests/core'
Making all in buffer
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/buffer'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/buffer'
Making all in decoder
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/decoder'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/decoder'
Making all in descriptor
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/descriptor'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/descriptor'
Making all in encoder
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/encoder'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/encoder'
Making all in stream
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/stream'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/stream'
Making all in varint
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/varint'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/varint'
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core'
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core'
Making all in message
make[3]: Entering directory '/home/borbon/Repositories/protobluff/tests/message'
Making all in buffer
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/buffer'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/buffer'
Making all in cursor
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/cursor'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/cursor'
Making all in field
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/field'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/field'
Making all in journal
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/journal'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/journal'
Making all in message
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/message'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/message'
Making all in nested
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/nested'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/nested'
Making all in oneof
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/oneof'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/oneof'
Making all in part
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message/part'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message/part'
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/message'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message'
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/tests/message'
Making all in util
make[3]: Entering directory '/home/borbon/Repositories/protobluff/tests/util'
Making all in chunk_allocator
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/util/chunk_allocator'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/util/chunk_allocator'
Making all in descriptor
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/util/descriptor'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/util/descriptor'
Making all in validator
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/util/validator'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/util/validator'
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/util'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/util'
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/tests/util'
make[3]: Entering directory '/home/borbon/Repositories/protobluff/tests'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/tests'
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/tests'
make[2]: Entering directory '/home/borbon/Repositories/protobluff'
make[2]: Leaving directory '/home/borbon/Repositories/protobluff'
make[1]: Leaving directory '/home/borbon/Repositories/protobluff'
Making check in include
make[1]: Entering directory '/home/borbon/Repositories/protobluff/include'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/home/borbon/Repositories/protobluff/include'
Making check in src
make[1]: Entering directory '/home/borbon/Repositories/protobluff/src'
Making check in core
make[2]: Entering directory '/home/borbon/Repositories/protobluff/src/core'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/src/core'
Making check in message
make[2]: Entering directory '/home/borbon/Repositories/protobluff/src/message'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/src/message'
Making check in util
make[2]: Entering directory '/home/borbon/Repositories/protobluff/src/util'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/src/util'
Making check in generator
make[2]: Entering directory '/home/borbon/Repositories/protobluff/src/generator'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/src/generator'
make[2]: Entering directory '/home/borbon/Repositories/protobluff/src'
make[2]: Nothing to be done for 'check-am'.
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/src'
make[1]: Leaving directory '/home/borbon/Repositories/protobluff/src'
Making check in tests
make[1]: Entering directory '/home/borbon/Repositories/protobluff/tests'
Making check in core
make[2]: Entering directory '/home/borbon/Repositories/protobluff/tests/core'
Making check in buffer
make[3]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/buffer'
make test
make[4]: Entering directory '/home/borbon/Repositories/protobluff/tests/core/buffer'
CC test-test.o
test.c:24:10: fatal error: check.h: No such file or directory
24 | #include <check.h>
| ^~~~~~~~~
compilation terminated.
make[4]: *** [Makefile:441: test-test.o] Error 1
make[4]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/buffer'
make[3]: *** [Makefile:546: check-am] Error 2
make[3]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core/buffer'
make[2]: *** [Makefile:393: check-recursive] Error 1
make[2]: Leaving directory '/home/borbon/Repositories/protobluff/tests/core'
make[1]: *** [Makefile:614: check-recursive] Error 1
make[1]: Leaving directory '/home/borbon/Repositories/protobluff/tests'
make: *** [Makefile:502: check-recursive] Error 1
`

protoc-gen-protobluff throwing an instance of 'std::system_error'

Describe the bug

protoc --protobluff_out=. person.proto

creates an error:

terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
--protobluff_out: protoc-gen-protobluff: Plugin killed by signal 6.

To Reproduce

Steps to reproduce the behavior:

  1. Compile and install on Ubuntu
#! /usr/bin/env sh
# Install protobluff to user local

# Ubuntu
sudo apt install git gcc automake libtool protobuf-compiler libprotoc-dev libprotobuf-dev check

# get the sources
git clone https://github.com/squidfunk/protobluff protobluff.git
cd protobluff.git

# configure
./autogen.sh
./configure --prefix ${HOME}/.local

# build & test & install to user dir
make
make test
make install

# remove the git repository
cd ..
rm -rf protobluff.git
  1. Run protoc
protoc --protobluff_out=. person.proto

person.proto:

syntax = "proto2";

message Person {
  message PhoneNumber {
    enum PhoneType {
      MOBILE = 0;
      HOME = 1;
      WORK = 2;
    }
    required string number = 1;
    optional PhoneType type = 2 [default = HOME];
  }
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;
  repeated PhoneNumber phone = 4;
}
  1. See error
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
--protobluff_out: protoc-gen-protobluff: Plugin killed by signal 6.

Expected behavior

Generate without error.

Impact

showstopper

Logs and console output
N/A

Environment (please complete the following information):

  • OS: Linux, Ubuntu 19.10
  • Toolchain:
    • protoc --version: libprotoc 3.6.1
    • gcc --version: gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
  • Commit SHA or Version used: master

Additional context
N/A

buffer size not being cleared

In src/core/buffer.c circa line 136, in method pb_buffer_destroy, the buffer->data is set to NULL, but the buffer->size is not set to zero.

The issue is that if this same buffer is later given to pb_buffer_grow to add some space, the old non-zero size is used.

Also, pb_buffer_empty(b) on such a buffer will return false.

Build error with protobuf-3.7.0

Hi ,
I got this compile error when trying to build from source. May I know which protobuf version that you use to build this

make[3]: Entering directory '/home/tam/protobuf-analysis/protobluff/src/generator'
CXX protoc_gen_protobluff-enum.o
In file included from enum.cc:31:0:
../../src/generator/enum.hh:46:29: error: ‘google::protobuf::scoped_array’ has not been declared
using ::google::protobuf::scoped_array;
^~~~~~~~~~~~
../../src/generator/enum.hh:47:29: error: ‘google::protobuf::scoped_ptr’ has not been declared
using ::google::protobuf::scoped_ptr;
^~~~~~~~~~
../../src/generator/enum.hh:74:5: error: ‘scoped_array’ does not name a type; did you mean ‘sched_param’?
scoped_array<
^~~~~~~~~~~~
sched_param
In file included from enum.cc:33:0:
../../src/generator/strutil.hh:169:42: error: ‘vector’ has not been declared
vector* res);
^~~~~~
../../src/generator/strutil.hh:169:48: error: expected ‘,’ or ‘...’ before ‘<’ token
vector* res);
^
../../src/generator/strutil.hh:181:47: error: ‘vector’ has not been declared
vector* result);
^~~~~~
../../src/generator/strutil.hh:181:53: error: expected ‘,’ or ‘...’ before ‘<’ token
vector* result);
^
../../src/generator/strutil.hh:191:43: error: ‘vector’ does not name a type; did you mean ‘perror’?
LIBPROTOBUF_EXPORT void JoinStrings(const vector& components,
^~~~~~
perror
../../src/generator/strutil.hh:191:49: error: expected ‘,’ or ‘...’ before ‘<’ token
LIBPROTOBUF_EXPORT void JoinStrings(const vector& components,
^
../../src/generator/strutil.hh:194:33: error: ‘vector’ does not name a type; did you mean ‘perror’?
inline string JoinStrings(const vector& components,
^~~~~~
perror
../../src/generator/strutil.hh:194:39: error: expected ‘,’ or ‘...’ before ‘<’ token
inline string JoinStrings(const vector& components,
^
../../src/generator/strutil.hh: In function ‘std::cxx11::string google::protobuf::JoinStrings(int)’:
../../src/generator/strutil.hh:194:15: error: ambiguating new declaration of ‘std::cxx11::string google::protobuf::JoinStrings(int)’
inline string JoinStrings(const vector& components,
^~~~~~~~~~~
../../src/generator/strutil.hh:191:25: note: old declaration ‘void google::protobuf::JoinStrings(int)’
LIBPROTOBUF_EXPORT void JoinStrings(const vector& components,
^~~~~~~~~~~
../../src/generator/strutil.hh:197:15: error: ‘components’ was not declared in this scope
JoinStrings(components, delim, &result);
^~~~~~~~~~
../../src/generator/strutil.hh:197:27: error: ‘delim’ was not declared in this scope
JoinStrings(components, delim, &result);
^~~~~
../../src/generator/strutil.hh:197:27: note: suggested alternative: ‘getdelim’
JoinStrings(components, delim, &result);
^~~~~
getdelim
../../src/generator/strutil.hh: At global scope:
../../src/generator/strutil.hh:234:49: error: ‘vector’ has not been declared
vector *errors);
^~~~~~
../../src/generator/strutil.hh:234:55: error: expected ‘,’ or ‘...’ before ‘<’ token
vector *errors);
^
../../src/generator/strutil.hh:253:46: error: ‘vector’ has not been declared
vector *errors);
^~~~~~
../../src/generator/strutil.hh:253:52: error: expected ‘,’ or ‘...’ before ‘<’ token
vector errors);
^
enum.cc:47:29: error: ‘google::protobuf::scoped_ptr’ has not been declared
using ::google::protobuf::scoped_ptr;
^~~~~~~~~~
enum.cc: In constructor ‘protobluff::Enum::Enum(const google::protobuf::EnumDescriptor
)’:
enum.cc:61:7: error: class ‘protobluff::Enum’ does not have any field named ‘values

values
(new scoped_ptr[descriptor->value_count()]) {
^~~~~~~
enum.cc:61:19: error: ‘scoped_ptr’ does not name a type; did you mean ‘sched_param’?
values(new scoped_ptr[descriptor_->value_count()]) {
^~~~~~~~~~
sched_param
enum.cc:61:39: error: expected primary-expression before ‘>’ token
values_(new scoped_ptr[descriptor_->value_count()]) {
^
enum.cc:61:41: error: capture of non-variable ‘protobluff::Enum::descriptor_’
values_(new scoped_ptr[descriptor_->value_count()]) {
^~~~~~~~~~~
In file included from enum.cc:31:0:
../../src/generator/enum.hh:73:27: note: ‘const google::protobuf::EnumDescriptor* protobluff::Enum::descriptor_’ declared here
const EnumDescriptor descriptor_; / Enum descriptor /
^~~~~~~~~~~
enum.cc:61:52: error: expected ‘,’ before ‘->’ token
values_(new scoped_ptr[descriptor_->value_count()]) {
^~
enum.cc:61:52: error: expected identifier before ‘->’ token
enum.cc: In lambda function:
enum.cc:61:68: error: expected ‘{’ before ‘)’ token
values_(new scoped_ptr[descriptor_->value_count()]) {
^
enum.cc: In constructor ‘protobluff::Enum::Enum(const google::protobuf::EnumDescriptor
)’:
enum.cc:71:7: error: ‘values_’ was not declared in this scope
values_[v].reset(sorted[v]);
^~~~~~~
enum.cc: In member function ‘void protobluff::Enum::GenerateValues(google::protobuf::io::Printer*) const’:
enum.cc:93:7: error: ‘values_’ was not declared in this scope
values_[v]->GenerateValue(printer);
^~~~~~~
enum.cc: In member function ‘void protobluff::Enum::GenerateDescriptor(google::protobuf::io::Printer*) const’:
enum.cc:135:9: error: ‘values_’ was not declared in this scope
values_[v]->GenerateDescriptor(printer);
^~~~~~~
Makefile:506: recipe for target 'protoc_gen_protobluff-enum.o' failed
make[3]: *** [protoc_gen_protobluff-enum.o] Error 1
make[3]: Leaving directory '/home/tam/protobuf-analysis/protobluff/src/generator'
Makefile:546: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/tam/protobuf-analysis/protobluff/src'
Makefile:500: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/tam/protobuf-analysis/protobluff'
Makefile:411: recipe for target 'all' failed
make: *** [all] Error 2

Error compiling protoc-gen-chpl.cc

hey @squidfunk, great work on protobluff!

I am trying to build a plugin of my own for a new language taking your code as a base. I am facing a problem in compiling protoc-gen-chpl.cc to generate protoc-gen-chpl which I can pass to the protoc compiler.

I am doing something like-
g++ -I. protoc-gen-chpl.cc -lprotobuf -lpthread

but I am getting this error --->

/tmp/ccAq1MTE.o: In function `main':
protoc-gen-chpl.cc:(.text+0x3c): undefined reference to `google::protobuf::compiler::PluginMain(int, char**, google::protobuf::compiler::CodeGenerator const*)'
/tmp/ccAq1MTE.o: In function `google::protobuf::compiler::CodeGenerator::CodeGenerator()':
protoc-gen-chpl.cc:(.text._ZN6google8protobuf8compiler13CodeGeneratorC2Ev[_ZN6google8protobuf8compiler13CodeGeneratorC5Ev]+0xb): undefined reference to `vtable for google::protobuf::compiler::CodeGenerator'
/tmp/ccAq1MTE.o: In function `chapel::Generator::Generator()':
protoc-gen-chpl.cc:(.text._ZN6chapel9GeneratorC2Ev[_ZN6chapel9GeneratorC5Ev]+0x1b): undefined reference to `vtable for chapel::Generator'
/tmp/ccAq1MTE.o: In function `chapel::Generator::~Generator()':
protoc-gen-chpl.cc:(.text._ZN6chapel9GeneratorD2Ev[_ZN6chapel9GeneratorD5Ev]+0xf): undefined reference to `vtable for chapel::Generator'
protoc-gen-chpl.cc:(.text._ZN6chapel9GeneratorD2Ev[_ZN6chapel9GeneratorD5Ev]+0x22): undefined reference to `google::protobuf::compiler::CodeGenerator::~CodeGenerator()'
collect2: error: ld returned 1 exit status

I think I am not doing the linking properly, but I am not able to figure out what I am missing. It would be great if you give your opinions.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.