Awalias
Awalias

Reputation: 2127

Linking zeromq static library on solaris

I want to link the zeromq libraries in my build so they do not have to be installed separately on the end users machine.

I configured zeromq using:

./configure --enable-static --disable-shared --prefix=/home/xx/out

but when I do:

g++ -o zclient zmqclient.o /home/xx/out/lib/libzmq.a

I get linking errors:

Undefined                       first referenced
 symbol                             in file

recv                                /opt/zmq/out/lib/libzmq.a(libzmq_la-signaler.o)
send                                /opt/zmq/out/lib/libzmq.a(libzmq_la-signaler.o)
__xnet_connect                      /opt/zmq/out/lib/libzmq.a(libzmq_la-tcp_connecter.o)
__xnet_socket                       /opt/zmq/out/lib/libzmq.a(libzmq_la-ip.o)
__xnet_getsockopt                   /opt/zmq/out/lib/libzmq.a(libzmq_la-tcp_connecter.o)
accept                              /opt/zmq/out/lib/libzmq.a(libzmq_la-tcp_listener.o)
listen                              /opt/zmq/out/lib/libzmq.a(libzmq_la-tcp_listener.o)
uuid_generate                       /opt/zmq/out/lib/libzmq.a(libzmq_la-uuid.o)
setsockopt                          /opt/zmq/out/lib/libzmq.a(libzmq_la-tcp_listener.o)
getaddrinfo                         /opt/zmq/out/lib/libzmq.a(libzmq_la-ip.o)
freeaddrinfo                        /opt/zmq/out/lib/libzmq.a(libzmq_la-ip.o)
__xnet_socketpair                   /opt/zmq/out/lib/libzmq.a(libzmq_la-signaler.o)
__xnet_bind                         /opt/zmq/out/lib/libzmq.a(libzmq_la-tcp_listener.o)
uuid_unparse                        /opt/zmq/out/lib/libzmq.a(libzmq_la-uuid.o)
ld: fatal: symbol referencing errors. No output written to zclient
collect2: ld returned 1 exit status

Can anyone tell me where I am going wrong, or provide me with an alternative method?

Thanks!

Upvotes: 4

Views: 1732

Answers (1)

Awalias
Awalias

Reputation: 2127

Turns out the libraries:

-lsocket -lnsl -luuid

are standard on linux but not on solaris and need to be included in the Makefile like so:

g++ -lsocket -lnsl -luuid  zmqclient.cpp /home/xx/out/lib/libzmq.a   -o zmqclient

Upvotes: 3

Related Questions