ropensci / rzmq

R package for ZMQ
https://docs.ropensci.org/rzmq
84 stars 30 forks source link

use pkg-config to find libzmq's location #21

Closed indraniel closed 7 years ago

indraniel commented 9 years ago

This change allows rzmq to correctly find the zeromq library and header files with pkg-config if zeromq is installed in standard (e.g. /usr/lib, /usr/local/lib, /usr/include, /usr/local/include) or other alternative locations on the file system.

armstrtw commented 9 years ago

is this CRAN approved? do people use this? I've actually never heard of it.

indraniel commented 9 years ago

Apologies for my naive pull request. I'm a bit of a neophyte with writing R extensions and its idioms. pkg-config is mentioned in the Writing R Extensions document, section "1.2 Configure and cleanup" (bottom of page 19), but with respect to the configure file in the R extension package. I'm not sure if it's valid to place it in the Makevars file.

pkg-config is available for UNIX-like operating systems and Windows, but it may not be there by default.

I'm using R on a Linux-based system (Ubuntu) where the pkg-config program is already available for me (debian package pkg-config).

If you think this change is worthwhile to have, I may tinker with the change some more and place it within some conditional logic so that it will use your default approach if the pkg-config program isn't available.

indraniel commented 9 years ago

I've updated the change to use the original default approach if the pkg-config program isn't available on the installation system.

Let me know if you'd like me to make any other alterations. Feel free to abandon this pull request if you think the change isn't worthwhile.

Either way, many thanks for this R package!

mbmilligan commented 8 years ago

I'd like to second the request for this change. Right now it is somewhat painful to build rzmq when libzmq is installed in a non-standard location.

snoweye commented 8 years ago
mbmilligan commented 8 years ago

@snoweye Thanks for the pointer! I am working with IRKernel, which I see now has recently switched to using pbdZMQ, so that will solve the problem nicely.

armstrtw commented 8 years ago

Thanks for the patch. I'm not familiar w/ pkg-config, but I'll have a quick go.

As for the pbdZMQ situation. zmq has always been difficult to build as a shared lib on mingw. the makefile provided with zmq fails for mingw when asking for shared libs. I don't develop for windows at all, so I haven't had the ability to fix that issue.

The pbdZMQ guys have built the entire zmq library as part of the package. I oppose the duplication between the projects, but kudos to them for getting the build working.

indraniel commented 8 years ago

@snoweye: just curious, from your previous comment, why won't CRAN buy this solution?

snoweye commented 8 years ago

FYI. CRAN check.

armstrtw commented 8 years ago

so, @snoweye , have you all thought bout publishing the zmq libs as a library pacage? similar to RcppArmadillo. that other packages (like rzmq) could access via LinkingTo.

snoweye commented 8 years ago

Yes, it is possible for windows or systems don't have libzmq installed. Linkingto may not be possible in this case because zmq may not follow R's requirement to place headers and shared libraries. There are other ways to go around it, this needs time to test.

armstrtw commented 8 years ago

I think that would be a great way to go. I'll try to do some testing on it (spliting the zmq libs into a separate package). If it works, then @indraniel I think we can drop the patch as we'll just get the libs via LinkingTo.

indraniel commented 8 years ago

Sounds good to me!