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?

On Jan 20, 6:16 am, Jason Hsueh <jas...@google.com> wrote:
> Add -static to your ld command to link the program statically.
>
>
>
>
>
>
>
> On Wed, Jan 19, 2011 at 12:38 AM, triStone <liulei1...@gmail.com> wrote:
> > When I use this program in another computer, it reminder me that "
> > error while loading shared libraries: libprotobuf.so.6: cannot open
> > shared object file: No such file or directory".
> > How can I use this program in a computer without libprotobuf.so.6?
> > Should I change the compile script?
> > In my makefile, I use this
>
> > INCS :=  /usr/local/include
> > LIBS := -pthread -L/usr/local/lib -lprotobuf -lprotoc -lz
> > ....
> > ${OUTPUT}: ${OBJS}
> >    ${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS}
>
> > %.o : %.cpp
> >    ${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to protobuf@googlegroups.com.
> > To unsubscribe from this group, send email to
> > protobuf+unsubscr...@googlegroups.com<protobuf%2Bunsubscribe@googlegroups.c 
> > om>
> > .
> > 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 post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to