snoweye / pbdZMQ

Interface to ZeroMQ
GNU General Public License v3.0
17 stars 12 forks source link

Reliable way to get ZeroMQ library from the package? #72

Closed mschubert closed 3 years ago

mschubert commented 3 years ago

Hi,

I've previously used rzmq for my own package (HPC schedulers from R here), but I've come to a point where the R API is no longer sufficient and I am using the C++ bindings via Rcpp directly.

I would like to avoid (1) duplicating the ZeroMQ source in yet another package and (2) the end user of my package to have to install ZeroMQ themselves, so I was looking into whether I could link to pbdZMQ. However, as far as I understand, pbdZMQ only includes the ZeroMQ library if it was not found on the host system, or ENABLE_INTERNAL_ZMQ is active. Thus, I don't seem to be able to rely on pbdZMQ to provide ZeroMQ (and another complication is that I need the draft API built for ZMQ_ROUTER_NOTIFY).

Do you see a way I could still use pbdZMQ, and if not, would you be interested in splitting off a joint package that only provides the library?

wrathematics commented 3 years ago

You just need the include and link flags used by pbdZMQ (whether it built the library or linked with an external one), right? If so you can use these:

pbdZMQ::get.zmq.ldflags()
## -L/usr/lib/x86_64-linux-gnu -lzmq
pbdZMQ::get.zmq.cppflags()
## -I/usr/include
mschubert commented 3 years ago

That looks promising, thanks!

I'd still be missing ZMQ_ROUTER_NOTIFY (>=4.3.0 + draft) for both internal and (probably almost every) OS-provided libs

wrathematics commented 3 years ago

You can feature test at configure step. Maybe adapt something like this. Is that what you have in mind?

mschubert commented 3 years ago

Sure, I could add a check for this. But since the pbdZMQ version does not provide it and neither to most OS libs, I'd be back to providing my own library package, or have every user install theirs.

I guess the second part of my initial question would be:

Would you consider providing libzmq>=4.3.0 with (an option to?) -DENABLE_DRAFTS=ON with your package?

snoweye commented 3 years ago

When I get enough time, I will add a check in configure.ac as here, and the option to the include and link flags. However, I will not check/know if the libzmq enables the option or not at this moment.

To add 4.3.0 source inside the pbdZMQ would take much longer.

mschubert commented 3 years ago

Thank you both for your answers!

What I'm getting from this is that I will bundle libzmq with my own package and switch over to pbdZMQ if/when it can provide ZMQ_ROUTER_NOTIFY.

snoweye commented 3 years ago

Check please here as added. @mschubert @wrathematics