Re: [protobuf] cross compile protobuf 2.5 for arm-android

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
What kind of error are you getting? I have not tried cross-compiling
protobuf myself but I think the --with-protoc option is the right way to go
and I see you're already doing that. I'm not sure if you even need to pass
the --enable-cross-compile flag.

On Wed, Apr 12, 2017 at 12:55 AM, Andrea Sonnleitner <
andrea.sonnleitner1...@gmail.com> wrote:

> Hello everyone!
>
> I try to cross compile protobuf for an arm android architecture with the
> given configure step.
> However, the option "--enable-cross-compile" is not used as given here.
>
> checking whether we are cross compiling... no
>
>
>
>
> sudo ./configure --prefix=/home/staff/Desktop/proto_arm
> --build=armv7-android-linux-android --host=armv7-android-linux-android
> --target=armv7-android-linux-android --enable-cross-compile
> --with-protoc=/home/staff/Desktop/proto_arm/protoc
> CXXFLAGS="$(pkg-config --cflags protobuf)" LIBS="$(pkg-config --libs
> protobuf)"
>
> I am also not sure if I specified build/target/host correctly. I want to
> run a project including protobuf on an Android Phone with Android 6
> Marshmallow, ABIs are arm64-v8a, armeabi-v7a, armeabi.
>
> Thank you for any help!
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] How to store binary file data in structure?

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
What does Material.dat contain? Is it a single protocol buffer or a series
of protocol buffers?

On Mon, Apr 10, 2017 at 11:38 PM, revanth rao  wrote:

> down votefavorite
> 
>
> Hi all,
>
> I have a file shown below(Material.dat) which is binary file , I want to
> read data from the file and put in the structure(Header) for that I have
> used GetRecord() function.
>
> HANDLE hFileMac = ::CreateFile(_T("Material.dat"), GENERIC_READ, 
> FILE_SHARE_READ, NULL,
>   OPEN_EXISTING, FALSE ? FILE_FLAG_SEQUENTIAL_SCAN : FILE_ATTRIBUTE_NORMAL, 
> NULL);
>
>  if (!(hFileMac != INVALID_HANDLE_VALUE))
>  {
>   return;
>  }
>
>  GetRecord(hFileMac, RECORD_NUMBER, sizeof(Header), reinterpret_cast *>());
>
> My doubt is what to pass as a record number to Get Record() function?
>
> GetRecord(hFileMac, RECORD_NUMBER, sizeof(Header),
> reinterpret_cast());
>
> int GetRecord(HANDLE hFile, int RecordNumber, int RecordSize, void 
> *RecordPtr){
>  if (RecordNumber <= 0 || RecordSize <= 0)
>   return 1;
>  LONG lOffset = (RecordNumber - 1) * RecordSize;
>
>  if (SetFilePointer(hFile, lOffset, NULL, FILE_BEGIN) == 0x)
>   return 2;
>
>  DWORD dwSize;
>
>  if (::ReadFile(hFile, RecordPtr, RecordSize, , NULL) == 0)
>   return 3;
>
>  return 0;}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Error in example code in Protocol Buffers Python Tutorial

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
Thanks for reporting this, I'll make sure to fix it next week.

On Sat, Apr 8, 2017 at 2:43 AM, Hanks  wrote:

> According to the link: https://developers.google.com/
> protocol-buffers/docs/pythontutorial
>
> There is a error name defined in the .proto file,
>
> repeated Person people = 1; // should be `repeated Person person = 1;`
>
> Because src code in writing message like below:
>
> ```
>
> # Add an address.
> PromptForAddress(address_book.person.add())
>
> ```
>
> It is trivial one :) Thank you for time.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Javascript with Protobuf FileDescriptorSet and what is equivalent to DynamicMessage.parse(FileDescriptor, byte[] payload) ?

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
Unfortunately the Javascript implementation doesn't support this kind of
DynamicMessage functionality. In Javascript you can only really manipulate
a protocol buffer if you have already built the generated code with protoc.

On Fri, Apr 7, 2017 at 5:15 PM, Vijay Balakrishnan 
wrote:

> Hi,
> Newbie to protobuf and pardon my naivete on this topic.
>
> I would like to use protoc --descriptor_set_out=out.desc  -js_out=
> import_style=commonjs,error_on_name_conflict,binary:.  mymessage.proto
>
> I have code to upload this out.desc to my server to S3. using out.desc as
> I want multiple clients to upload their separate descriptor files to me
> I have a node.js micro-service and want to be able to handle a byte[]
> payload using this out.desc. The micro-service receives a key along with
> the byte[] payload. I use the key on the backend to identify the out.desc
> filedescriptor to use.
> In Java, I can use DynamicMessage.parse(FileDescriptor, byte[] payload)
> to do this after identifying the relevant desc file using a key to connect
> the client to the desc file.
>
> How do i do this in javascript or node.js ?
>
> TIA,
> Vijay
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Find and set data to a sub message by message path.

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
One thing that might help is to use a FieldMask
,
since that can essentially represent the kind of path string you mentioned.
You can then use FieldMaskUtil::MergeMessageTo

to update just the fields identified by the field mask.

On Thu, Apr 13, 2017 at 8:25 PM, Trung Hoang Nguyen <
hoangtrung88@gmail.com> wrote:

> Hi everyone,
>
> I'm newbie of Google buffer protocol, and now I have an issue as below:
> I have a path string and value like that:
>
>> path_string = "classA.classB.classC.foo_variable ";
>> set_value = 1000;
>
>
> a common set function:
>
>> void set(path_string, set_value);
>
>
> and some messages:
>
> message classA {
>> ...
>> classB = 1;
>> }
>> message classB {
>> ...
>> classC =1;
>> }
>> message classC {
>> ...
>> int foo_variable = 10;
>> }
>
>
> Now with the path_string I need to find out the foo_variable and set its
> value to 1000.
> How can I do it with google buffer protocol?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Is possible to use enum from external class in .proto files?

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
Yes, that should work. Unless I'm misunderstanding something, you should
just be able to do what Henner suggested above to accomplish this.

On Fri, Apr 7, 2017 at 5:46 AM,  wrote:

> Hi, on the same lines need help on an idea.
>
> Is it possible to define my enums in one .proto file and use them across
> other .proto files.
> In context of grpc protobuf3.
>
> Any help is appreciated.
>
> On Friday, December 7, 2012 at 10:49:29 AM UTC+5:30, Henner Zeller wrote:
>>
>> On 6 December 2012 15:32, Milan Stankovic  wrote:
>>
>>> Is possible to use enum from external class ? I have couple .proto
>>> definition and all need to use same enum Type with same tokens. I want to
>>> avoid definition of same enum in every class and to avoid sync between, I
>>> have that enum in regular external c++ class which I use in code.
>>
>>
>> It is not possible to have an external C++ enum somewhere, as this would
>> require the proto parser to parse C++.
>>
>> However, what I usually do in that case is to define my enumeration in a
>> separate *.proto file
>> myenums.proto ---
>> enum Foo {
>>a = 1;
>>b = 2;
>>c = 3;
>> };
>>
>> enum Bar {
>> x = 1;
>> }
>> --
>>
>> from this, you can generate a myenums.pb.h - it essentially contains the
>> enumerations as you would write them in C++ anyway, and some useful
>> conversion functions (e.g. that convert it to a printable version).
>> (also, this would generate enumeration for other languages as well, if
>> you need it). From there, you can just use these enums as any other enums.
>>
>> Also, in your other proto-buffer files, you then can import this file and
>>  use the enumeration
>>
>> otherprotofile.proto 
>> import "myenmus.proto";
>>
>> message MyMessage {
>>   Foo foo_enum = 1;
>> };
>> --
>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> g/protobuf/-/H0dBbyOrwrgJ.
>>> To post to this group, send email to prot...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> protobuf+u...@googlegroups.com.
>>> For more options, visit this group at http://groups.google.com/group
>>> /protobuf?hl=en.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] (3.2.0) Reporting Test Suite Failure on OpenBSD

2017-04-14 Thread 'Adam Cozzette' via Protocol Buffers
Hi Brad, thanks for reporting this. We (the protobuf-team) don't have
convenient access to Solaris or OpenBSD machines to debug this ourselves,
but that is interesting to know that the same issue is apparently affecting
both of those platforms. Feel free to send us a pull request if you happen
to figure out what the problem is.

On Fri, Apr 7, 2017 at 5:36 AM, Brad DeMorrow  wrote:

> I believe this is the same dump that has been reported for solaris boxes
> under issue 1755:
> https://github.com/google/protobuf/issues/1755
>
> I will chime in on that issue as well, but I wanted to report here since
> that's what the test suite says to do.
>
> Thank you all,
> Log attached and bt from core dump below:
>
>
> (gdb) bt
> #0  0x0cb218ab7d14 in testing::Sequence::AddExpectation () from
> ./.libs/libgmock.so.0.0
> #1  0x0caf7b43acfb in
> testing::internal::MockSpec converter::ObjectWriter*
> ()(google::protobuf::StringPiece, bool)>::InternalExpectedAt ()
>from /usr/ports/pobj/protobuf-3.2.0/build-amd64/src/.libs/protobuf-test
> #2  0x0caf7b440525 in
> google::protobuf::util::converter::ExpectingObjectWriter::RenderBool ()
>from /usr/ports/pobj/protobuf-3.2.0/build-amd64/src/.libs/protobuf-test
> #3  0x0caf7b45a3c6 in
> google::protobuf::util::converter::JsonStreamParserTest_
> SimpleTrue_Test::TestBody
> ()
>from /usr/ports/pobj/protobuf-3.2.0/build-amd64/src/.libs/protobuf-test
> #4  0x0cb2059dd271 in
> testing::internal::HandleExceptionsInMethodIfSupported void>
> () from ./.libs/libgtest.so.0.0
> #5  0x0cb2059d394a in testing::Test::Run () from
> ./.libs/libgtest.so.0.0
> #6  0x0cb1f2b9a600 in ?? ()
> #7  0x0cb20fab6c00 in ?? ()
> #8  0x0cb23aab0bc0 in ?? ()
> #9  0x0cb2059d3a98 in testing::TestInfo::Run () from
> ./.libs/libgtest.so.0.0
> #10 0x0cb1bf4c1198 in ?? ()
> #11 0x0001 in ?? ()
> #12 0x0cb25d7b1d00 in ?? ()
> #13 0x0cb20fab6c00 in ?? ()
> #14 0x0cb23aab0bc0 in ?? ()
> #15 0x0cb2059b70a0 in testing::TestCase::total_test_count () from
> ./.libs/libgtest.so.0.0
> #16 0x015b484fe103 in ?? ()
> #17 0x0cb2059d3b75 in testing::TestCase::Run () from
> ./.libs/libgtest.so.0.0
> #18 0x0cb2059d3e88 in testing::internal::UnitTestImpl::RunAllTests ()
> from ./.libs/libgtest.so.0.0
> #19 0x0795 in ?? ()
> #20 0x0001 in ?? ()
> #21 0x0cb1fe304a4e in _dl_bind (object=0x0, index=Variable "index" is
> not available.
> ) at /usr/src/libexec/ld.so/amd64/rtld_machine.c:357
> #22 0x0cb205afac48 in testing::internal::kStackTraceMarker () from
> ./.libs/libgtest.so.0.0
> #23 0x in ?? ()
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Protobuf with Python - MAC OSX

2017-04-14 Thread Glen-Erik Cortes
Hello,

I am trying to use protobuf with Python 3.6 or 2.7. Python cannot find 
protobuf, but I see the files under: /usr/local/Cellar/gdbm/1.13/lib/

I also see a file called protoc 
in /usr/local/Cellar/protobuf/3.2.0_1/bin/protoc.

Right now Python3.6 can see Numpy and Pandas but not Protobuf. Python 2.7 
can't see any of them.

These are the steps I followed:

1. brew install python
2. pip install pandas protobuf jedi

That didnt work so I downloaded Python 3.6 and installed it like any app.

Then tried again in the terminal.

Here is the terminal code:

Last login: Mon Apr 10 15:35:14 on ttys000
GEC-Macbook-Air:~ GEC$ brew install python
==> Installing dependencies for python: readline, sqlite, gdbm, openssl
==> Installing python dependency: readline
==> Downloading 
https://homebrew.bintray.com/bottles/readline-7.0.3_1.el_capitan
 
100.0%
==> Pouring readline-7.0.3_1.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.


For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
  /usr/local/Cellar/readline/7.0.3_1: 46 files, 1.5MB
==> Installing python dependency: sqlite
==> Downloading 
https://homebrew.bintray.com/bottles/sqlite-3.18.0.el_capitan.bo
 
100.0%
==> Pouring sqlite-3.18.0.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS provides an older sqlite3.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
  /usr/local/Cellar/sqlite/3.18.0: 11 files, 3.0MB
==> Installing python dependency: gdbm
==> Downloading 
https://homebrew.bintray.com/bottles/gdbm-1.13.el_capitan.bottle
 
100.0%
==> Pouring gdbm-1.13.el_capitan.bottle.tar.gz
  /usr/local/Cellar/gdbm/1.13: 19 files, 554.4KB
==> Installing python dependency: openssl
==> Downloading 
https://homebrew.bintray.com/bottles/openssl-1.0.2k.el_capitan.b
 
100.0%
==> Pouring openssl-1.0.2k.el_capitan.bottle.tar.gz
==> Using the sandbox
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto 
libraries

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
  /usr/local/Cellar/openssl/1.0.2k: 1,696 files, 12MB
==> Installing python 
==> Downloading 
https://homebrew.bintray.com/bottles/python-2.7.13.el_capitan.bo
 
100.0%
==> Pouring python-2.7.13.el_capitan.bottle.1.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
  rm '/usr/local/bin/2to3'

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Possible conflicting files are:
/usr/local/bin/2to3 -> 
/Library/Frameworks/Python.framework/Versions/3.6/bin/2to3
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg 
install
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg 
install
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg 
install
==> Caveats
Pip and setuptools have been installed. To update them
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install 

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: http://docs.brew.sh/Homebrew-and-Python.html
==> Summary
  /usr/local/Cellar/python/2.7.13: 3,526 files, 48MB
GEC-Macbook-Air:~ GEC$ pip install pandas protobuf