Questions tagged [protobuf-c]
Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data
207
questions
0
votes
0
answers
30
views
Protobuf message on subdirestory CMake Linux c++
need to generate and connect the message.proto file to the unit tests. CMake throws an error:fatal error: protobuf/message.pb.h: not found #include <protobuf/message.pb.h>
CMakeLists.txt:
...
-2
votes
0
answers
72
views
"optional" field of proto3 not supported by protobuf-c compiler
We recently started using proto3 and the protobuf/protobuf-c compiler gives us this error message:
Filename.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-c hasn'...
0
votes
0
answers
111
views
What is the normal, correct way to use Protobuf in a VC++ project on Windows?
I'm new to C++ and I'm writing a simple program that uses protobuf definitions (.proto) as part of its work. I come from C# and had a lot of trouble understanding how to use protobuf in my VC++ ...
0
votes
0
answers
29
views
How to enable reflection for message created with DynamicMessageFactory?
Code that creates a message:
std::unique_ptr<Message> MessagePacker::BuildMessage() const {
google::protobuf::DynamicMessageFactory factory;
Message* msg = factory.GetPrototype(descriptor_)-&...
-1
votes
1
answer
29
views
How does protobuf2 communicate with protobuf-net
In my project I use protobuf c for the server and protobuf-net for the client. But protobuf c cannot decode classes where the client uses the "ProtoInclude" attribute.
This is the client ...
0
votes
1
answer
50
views
Why is my protobuf not working correctly with enum types?
This is the proto file:
package net;
message msgBase {
optional string protoName = 1;
optional SendType sendType = 2;
//optional NetClient sendClient = 3;
optional float roomID = 4;
//...
0
votes
0
answers
41
views
Coverage parameters of the clang code coverage function change the code logic?
I have a section of the BUILD.gn file configured as follows:
config("test") {
cflags = [
"-std=c++17",
"-fvisibility=hidden",
]
cflags_cc = [ "-...
3
votes
0
answers
148
views
TensorFlow 2.13.0 Protobuf FATAL ERROR on Inference C++ test
I just compiled TensorFlow 2.13.0, on Slackware with kernel 4.19.288 with nvidia Driver Version: 535.54.03 and CUDA Version: 12.2, C++ APIs. When I try to start compiled inference test it gives me ...
1
vote
0
answers
149
views
cannot link against protobuf using c++ in linux
I am trying to just do a simple example for protobuf and I am having trouble linking. I haven't found anything worthwhile on here.
For starters, I have a very barebones .proto file
tempproj.proto
...
0
votes
0
answers
60
views
Build Error while installing ONNX in Linux
In order to install OnnX library for linux after cloning the repository.
git clone --recursive https://github.com/Microsoft/onnxruntime
Then ran the build.sh with the following configuration --skip-...
0
votes
1
answer
81
views
Which versions of google-cloud-pubsub and mysql-connector-python are compatible?
I'm setting up a project that will utilize both a MySQL DB and Google PubSub and it will be hosted in GCP. I'm working on the dependencies and I ran into an error when installing both packages:
mysql-...
1
vote
1
answer
73
views
Google protobuf adds weird 0xff values when decoding bytes which are larger or equal to 0x80 from message
I have this message file:
message samplemessage
{
optional bytes byte_string = 1;
}
And this program which uses this protobuf file:
#include <iostream>
#include <fstream>
#include <...
0
votes
0
answers
14
views
error: undefined reference to 'google::protobuf::ShutdownProtobufLibrary() [duplicate]
While building the protobuf and protobuf-c and clang. I'm facing some error.
What my guess is I'm unable to link the protobuf while invoking the cmake for building clang despite me passing -L/usr/...
1
vote
1
answer
187
views
Linking warning in protobuf-c
The build script:
if [ -f ${PWD_PATH}/succeed/protobuf-c ]; then
echo "git clone https://github.com/protobuf-c/protobuf-c.git"
eval "git clone https://github.com/protobuf-c/...
0
votes
0
answers
58
views
In Tensorflow, how to get the shape of all tensors in a graph with c++?
If the shapes of all tensors in a tensorflow graph are well defined, I want to be able to extract the shape of all tensors. The tensorflow graph is saved as a protobuf file. Here is an example of it ...
0
votes
0
answers
17
views
Unable to run Constructing Repeated Submessages With Protobuf-c
I am trying to run the example file given in the Wiki, but I am not able to see the output that is shown in the wiki example.
I copied the contents in the code blocks to files fmessage_serialize.c and ...
1
vote
1
answer
643
views
Cmake find_package(Protobuf REQUIRED) does not work out as I wanted
My goal is to configure cmake file and build my app with protobuf lib.
My attempted steps:
built protobuf in Ubuntu 20.04 followed this section of instruction from protobuf github repo C++ Protobuf - ...
1
vote
0
answers
83
views
Repeated submessage fields always decodes to zero
I have a somewhat deeply nested .proto. Message is a union, Update is a member of that union (ignoring the others for the sake of this question), Update contains a repeated Config (added just once for ...
0
votes
1
answer
67
views
How to parse com.google.cloud.retail.v2.Product object to JSON?
I am implementing Google Retail Search into the project. Google API require me to provide Product object in given JSON format. JSON representation of Product with minimum number of fields populated ...
-1
votes
1
answer
426
views
generate c++ source files from multiple proto files with import statements from directory structure in windows bat file
С++ project in MS Visual studio. When adding a new feature - support of the grpc, it looked quite logic to me 1) add grpc in the system 2) create a bat file with command-line call of protoc and call ...
1
vote
1
answer
237
views
Adding protobuf in yocto recipe
How can we add protobuf specific version (say : 3.19.6) in the yocto recipe?
what are the things that we can add in the yocto recipe to install protobuf 3.19.6
0
votes
1
answer
64
views
Instantiate struct by name or ID in C
I know reflection is not possible in C, but I have a unique issue in an embedded environment that can only allocate memory at init time.
We are using an embedded version of 0MQ and nanopb for ...
0
votes
1
answer
146
views
Why does my_msg__get_packed_size() return 0 on empty message?
I am trying to use the protobuf-c library to send messages in between sockets in C.
Steps to reproduce
Create a .proto file with the messages:
syntax = "proto3";
message MyMsg {}
Compile ...
0
votes
1
answer
196
views
SerializeAsString - server, ParseFromString - client. "Decode error" Exception occurred, but the data looks correct
Our application workflow uses protobuf for cross-language IPC.
We have a C++ application publishing data over Linux shared memory to various clients on the same host.
Data is published to shared ...
0
votes
0
answers
68
views
Is there a way to change a value while using an iterator when using c++ protobuf?
I want to modify the value of manifest.xml in c++. I use an iterator to find a specific value, but the value is not modified. Is there any way to change it?
Below is the code I used.
thank you.
int ...
0
votes
1
answer
548
views
proto import file not found (project was managed by bazel), How can I set the import path correctly?
I use bazel to manage my project and I want to generate protobuf files by bazel build. Here is my file path tree:
There are two problems:
How to make geometry.proto import matrix.proto (in the same ...
0
votes
0
answers
75
views
If I could use SIMD process ProtoBuf RepeatedField data directly,or is there a way to parse RepeatedField to vector efficiently?
I use ProtoBuf RepeatedField<uint32_t> store my 64 bit uint vector.Now I want to get the sum or product of two RepeatedField,and I want to use SIMD to accelerate the speed.
If I could access the ...
-1
votes
1
answer
340
views
How to read protobuf FileOptions in C++?
In the Google proto3 examples they show both global and nested custom options, including:
extend google.protobuf.FileOptions {
string my_file_option = 1001;
}
option (my_file_option) = "hello ...
0
votes
0
answers
27
views
How to erase repeated_field of protobuf::mutable pointer? [duplicate]
I have a protobuf::mutable pointer,
auto del_list = message_my.mutable_del_list()
I want to delete its repeated_field.h which times below 10, so I use the function below:
for (auto del_item = ...
0
votes
1
answer
791
views
Set elements from array pointer into protobuf in C++
I have a pointer to an array called array which is defined as uint16_t *array. I have another variable called size that shows how many elements there is. I have a field in a protobuf message defined ...
0
votes
1
answer
212
views
Protobuf packed (de)serialization
Since protobuf does not support the uint16_t datatype, I have a field below describing what I have in place.
uint32_t fingerprints = 1 [packed=true];
To save space, I have a C++ program that packs ...
0
votes
1
answer
371
views
C++ protobuf BuildFile with imports/dependencies not loaded
Given the following dmp.proto file...
syntax = "proto3";
import "google/protobuf/any.proto";
import "google/protobuf/descriptor.proto";
message Engine1Specific {
...
0
votes
1
answer
181
views
nanopb - how to specify encoding of integer in proto file
How do I set a int32 to use a fixed size for encoding?
In the API, it says
PB_LTYPE_FIXED32 0x04 32-bit integer or floating point.
But what option do I set in the .proto file to encode a int32 ...
0
votes
1
answer
937
views
nanopb/protobuf - how to force max size serialization/encoding
Documentation for pb_ostream_from_buffer says
After writing, you can check stream.bytes_written to find out how much
valid data there is in the buffer. This should be passed as the
message length on ...
0
votes
1
answer
97
views
nanopb, google-protobuf - can I set the length of the message as part of the serialized data itself?
I have a message
message Msg
{
uint32 a;
uint32 b;
bool c;
}
When I write a message using pb_encode I notice that the amount of stream.bytes_written depends on how many of the Msg fields were changed ...
0
votes
1
answer
284
views
nanopb pb_istream_from_buffer - what is value of bufsize?
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize);
buf - Pointer to byte array to read from.
bufsize Size of the byte array.
What is the argument for bufsize? Is it the ...
1
vote
1
answer
356
views
google protobuf - how to access size of buffer as specified in .proto file?
My protobuf file is
message Msg{
// User Authentication data as bytes.
bytes MsgData = 1 [(nanopb).max_size = 2048];
}
When I generate the C API, the relevant parts are:
#define ...
0
votes
0
answers
560
views
ProtocolBuffer C++ Visual Studio 2019
I am trying to build Protocolbuffer for Visual Studio 2019 x86,
I followed the steps in this page
https://github.com/protocolbuffers/protobuf/blob/main/cmake/README.md
for release I tried:
cmake -G &...
0
votes
1
answer
2k
views
When I'm trying to compile the Protobuf in golang, It's showing '"int" is not defined.'
While compiling the proto file, I'm getting '"int" is not defined'.
'test.proto' file
syntax = "proto3";
package test;
option go_package = "/;test";
message User {
...
0
votes
0
answers
108
views
How to solve "plugin failed code 127" compiling with nanopb
I am trying to compile a c++ code in an conan enviroment, here are details:
Ubuntu 18.04 WSL x86-64
Windowns 10 x64
python 3.7.5
protoc 3.19.4
The project is located at /mnt/c/project
The build ...
-1
votes
1
answer
1k
views
install protobuf on MacOS 12.0.1 error: C compiler cannot create executables
I'm trying to install protobuf using these instructions: https://github.com/protocolbuffers/protobuf
However when I run the local ./configure file with C++ installed on my local MacOS
q@Q-336-MacBook-...
1
vote
0
answers
89
views
How to generate values for all fields including required fields in a protobuf message
I have a big protobuf message. I'd like to set all the fields of the message including optional and required fields.
Is there any way to do it without using the set_field_name() for each field in the ...
0
votes
1
answer
801
views
How To Export Compiled Protobuf to Static Library C++
I want to make a static library containing .cc and .h files that are generated from protoc compiler to link with it from other project, I'm using C++
0
votes
0
answers
195
views
Find point of difference in two Google protobufs
I'm comparing two very large protobufs to figure out if there is a difference and if there is the point of divergence.
I'm using MessageDifferencer which points out that there are differences between ...
1
vote
0
answers
564
views
Unable to build C++ project w/ protobuf
I'm having trouble figuring out how to build a project with C++ protobufs. I'm on arm Mac and followed the instructions here to the T but keep on getting the error shown below when trying to build my ...
0
votes
1
answer
122
views
Generate pb.c/pb.h files using protobuf-c without anonymous members in structs
I am trying to generate some pb.c and pb.h files using protobuf-c. I have earlier use nanopb to generate the same files but need to move to protobuf-c for a new project.
When generating the structure ...
2
votes
1
answer
117
views
Go import scope lookup for protobuf types
I'm building a transpiler and need to understand the protobuf/go scope lookup system. I've been trying to google the docs and finding no luck.
Q: Is there a shared package scope lookup that you can do ...
0
votes
1
answer
305
views
Using "string_view" to represent the "string" key
When I use map<string, string> kv; in protobuf 3.8.0, the next code works:
std::string_view key("key");
kv[key] = "value";
While in protobuf 3.19.4, the above code doesn't ...
1
vote
1
answer
279
views
gRPC giving linkage errors in c++
I am writing a program using gRPC in the language c++. I have installed gRPC using the command brew install grpc on a MacOS I also have the most up to date version of protobuf. When I create a basic ...
1
vote
1
answer
124
views
Wrong protobuf deserialization on ARMv7
Note: I am completely new to working with different cpu architectures and working with C / gcc
I am trying to create an application written in plain C, which receives UDP messages from a server that ...