Yes, according to current gRPC implementation, stream can't be used with LITE_RUNTIME configuration in the .proto file?
Thanks, Roy. On Tue, Dec 4, 2018 at 7:19 PM Adam Cozzette <[email protected]> wrote: > For one Android binary I worked on recently, the protobuf runtime used > about 135 KB of space. This was for an ARM build, and I imagine the amount > could vary quite a bit depending on the platform and what runtime code you > end up depending on. > > I'm not familiar with that gRPC issue, so you may want to ask the gRPC > folks about that. Does the "stream" modifier prevent you from > setting optimize_for = LITE_RUNTIME in the .proto file? > > On Mon, Dec 3, 2018 at 11:05 PM Roy Barda <[email protected]> wrote: > >> Thank you Adam for the detailed suggestion. >> >> 1. Can you please let me know what was the addition in KB/MB of protobuf >> usage when you linked it statically to your Android code? >> 2. Using libprotobuf-lite blocks me from using the "stream" modifier >> (streaming feature) in gRPC, anyway to work around it? >> >> Appreciate your help, >> Roy. >> >> On Tuesday, December 4, 2018 at 5:51:57 AM UTC+2, Adam Cozzette wrote: >>> >>> Do you plan to link statically or dynamically against the protobuf >>> library? If you can link against it statically, I think you may find that >>> the linker is able to remove a lot of unused code. For Android (which is an >>> environment where we care a lot about code size), what we generally do is: >>> - Use lite protos only (i.e. set option optimize_for = LITE_RUNTIME in >>> every .proto file) >>> - Link against libprotobuf-lite and not libprotobuf >>> - Pass -ffunction-sections and -fdata-sections to the compiler and >>> -Wl,-gc-sections to the linker to maximize the linker's ability to strip >>> out unused code >>> >>> On Sun, Dec 2, 2018 at 10:34 PM Roy Barda <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> I have build protobuf on my Ubuntu environment and saw that the >>>> libraries size are extremely big. >>>> >>>> 28 MB for libprotobuf. >>>> 4 MB for libprotobuf-lite >>>> >>>> I'm aware of nanopb project but I need to use gRPC with protobuf and >>>> there is no good, working and maintained solution for nanopb. >>>> >>>> I followed the regular build process when I built protobuf (with no >>>> special configuration) >>>> >>>> Is there any way to reduce the protobuf library footprint? We are >>>> looking for a 1MB solution. >>>> >>>> Thanks, >>>> >>>> Roy. >>>> >>>> -- >>>> 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
