[zeromq-dev] linking with libzmq with pgm support failed

Martin Lucina mato at kotelna.sk
Wed Mar 10 22:34:32 CET 2010


Ayman,

sustrik at 250bpm.com said:
> > I try to link my source with libzmq 2.0 beta2  which it was build with 
> > pgm support but linking is failed because of
> > 
> >  undefined references. Please see the output snapshot bellow. As far I 
> > can see in ZeroMQ documentation there is no need to build
> > openpgm by my own, right?
> 
> No. 0MQ build system should build it for you.
> 
> >  Any help is appreciated.
> 
> As far as I can see, what you are missing is glib. OpenPGM is dependent 
> on glib and you should have it installed before you start building 0MQ.

Presumably you have glib installed since you've managed to build 0MQ.

The problem is that you are trying to use static linking. This is not a
good idea, since among other things it means your application will have to
be linked with all the dependencies of libzmq.a, which for builds with
OpenPGM includes GLib and friends, *and* unless it's a C++ application
built with G++ you will also have to link in libstdc++.

In other words, I suggest you take the easier route and use shared
libraries (ditching any -static option to gcc), in which case linking with
just -lzmq will be sufficient since libzmq.so should pull in any other
dependencies automatically.

-mato



More information about the zeromq-dev mailing list