ZeroMQ on Legato?


Hello everyone,

I have a problem that I can’t solve without any help:
After I tried some test programs with the WP7102 I wanted to use ZeroMQ as a message broker for my future programs.
So I installed the library on my host and on my target and the “hello world” sample from ZeroMQ works on the target as well as on the host, so I think I installed the libraries correctly.
Now I wanted to write this “hello world” sample from ZeroMQ in Legato and the only thing I changed is I used LE_INFO instead of printf and COMPONENT_INIT instead of int main (void).
But there always appears the same error:

root@swi-mdm9x15:~# app start zmq
Starting app ‘zmq’…
myServer: error while loading shared libraries: cannot open shared object file: No such file or directory
myClient: error while loading shared libraries: cannot open shared object file: No such file or directory
root@swi-mdm9x15:~# app status
[running] airvantage
[running] audioService
[running] cellNetService
[running] dataConnectionService
[running] modemService
[running] positioningService
[running] voiceCallService
[stopped] zmq

Here is the logread from the “app start zmq” command: [attachment=2]recording app start logread.txt[/attachment]

In the .adef file I included the library in the “bundles” section like the following:
[r] /lib

And in the .cdef files like the following:

When I try to execute only the client or only the server in the .adef file, it doesn’t work, too.
Also here is what comes when I type the “make wp7” command and what I get when I run the “instapp” command: [attachment=0]recording make wp7.txt[/attachment]
[attachment=1]recording instapp.txt[/attachment]

I hope you can help me :slight_smile:

Thank you!


And here is my app:


Hi, Daniel,

It looks like your program is trying to open, but the library appears in your application’s sandbox as

If you change the bundles section to this, it should work:

    [r] /lib/


Note that because your COMPONENT_INIT functions never return, your program will never be able to process any other events. In your trivial sample app, this is not a problem, but if you want to start using asynchronous notification features of some APIs (such as the le_data API’s notification when your cellular data connection comes up or goes down), you’ll need to either spawn another thread or find a way to return from your COMPONENT_INIT.

Obviously, if you go multi-threaded, then you have to worry about races between threads, etc.

Fortunately, 0MQ provides a mechanism for integrating with other event loops, and that works with ours too.

The function zmq_getsockopt() can be used to fetch the file descriptor associated with the 0MQ socket (option ZMQ_FD). This can then be monitored for “readability” using a Legato “file descriptor monitor” ( … vent_files).

After you have created a file descriptor monitor and set your “readability” handler function, when a message arrives on your 0MQ socket, your handler function will be called. You should move your while loop into that handler function. But, remember to make sure that loop doesn’t block, or you’ll just be stopping your event loop there instead of in your COMPONENT_INIT. You can do a non-blocking zmq_recv() (using the ZMQ_DONTWAIT option flag) and return from your handler function if zmq_recv() reports that there’s nothing to receive.

I hope this helps!



Thanks a lot for your help!