Search code examples
zeromq

zeroMQ: cannot open libzmq.so.4


I am trying to install the zeroMQ for my server(redhat 7). Here is what I did:
1) download the zeroMQ and unpack it.
2) navigate to the file where I put the zeroMQ and run the commands below:
./configure
make
make install

Now I can find two head files in /usr/local/include: zmq.h and zmq_utils.h and five files in /usr/local/lib: libzmq.a libzmq.la libzmq.so libzmq.so.4 libzmq.so.4.0.0.

Then I try to code like this:

#include <zmq.h>
...
void * context = zmq_init(1);

But I get this error message: undefined reference to `zmq_init'
I find that the include works well but it cant find 'zmq_init', so maybe it's the problem of lib files. But all of the lib files have been in /usr/local/lib, right?

What should I do?


Solution

  • Problem solved:

    I got that error message because the lib files are in the directory: /usr/local/lib
    What we need to do is to create a file named local-lib.conf under the directory /etc/ld.so.conf.d/ and write /usr/local/lib in it. The name of the file is not important but its extension must be .conf.
    Then, we must navigate to /etc/ld.so.conf.d/ and type this command: sudo ldconfig