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] <javascript:>> > 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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.
