On Wed, Jan 19, 2011 at 9:15 PM, triStone <[email protected]> wrote: > Thanks. > But if I also use "gethostbyname" function. So when I add -static > option, there will be a warning like this. > warning: Using 'gethostbyname' in statically linked applications > requires at runtime the shared libraries from the glibc version used > for linking > I search this warning on the web, it seems a bug of glibc, and it > maybe cause the program crash. > So if I use static link, this program will crash, if I use dynamic > link, this program can't execute in other machine because no > "protobuf.so", how can I do? >
C++ and static linking doesn't really mix anyway, ignoring all the glibc issues that make static linking dangerous on Linux. You either need to provide the protobuf dynamic libraries with your application, or build it on your target machine. Note that if you ship the protobuf libraries to a machine with a different version of the C++ runtime installed, bad things will happen. You can ship that too, but that's quite a nightmare. I wouldn't bother with libraries if you're shipping source to the target machine like you appear to be doing, just build protobuf on that machine too. Adam -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
