mschubert / clustermq

R package to send function calls as jobs on LSF, SGE, Slurm, PBS/Torque, or each via SSH
https://mschubert.github.io/clustermq/
Apache License 2.0
146 stars 27 forks source link

Outdated ZeroMQ on system trumps bundled version(?) #327

Closed HenrikBengtsson closed 1 month ago

HenrikBengtsson commented 7 months ago

It seems like the fallback to the bundled ZeroMQ, as in

SystemRequirements: ZeroMQ (libzmq) >= 4.3.0 (optional; otherwise bundled)

doesn't detect outdated ZeroMQ versions on the system. On CentOS 7, which still comes with ZeroMQ 3.2.5, the configuration picks up that outdated version;

* system has libzmq -> linking system library

This results in compilation errors (see below).

Details

I get:

> install.packages("clustermq")
Installing package into '/home/alice/R/x86_64-pc-linux-gnu-library/4.3'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/clustermq_0.9.4.tar.gz'
Content type 'application/x-gzip' length 1571546 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘clustermq’ ...
** package ‘clustermq’ successfully unpacked and MD5 sums checked
** using staged installation
* system has libzmq -> linking system library
* libzmq without DRAFT API found -> disabling crash monitor feature
** libs
using C++ compiler: ‘g++ (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)’
g++ -std=gnu++17 -I"/path/to/R-4.3.3/lib64/R/include" -DNDEBUG -fPIC -Icppzmq -I'/home/alice/R/x86_64-pc-linux-gnu-library/4.3/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c CMQMaster.cpp -o CMQMaster.o
In file included from common.h:9,
                 from CMQMaster.h:2,
                 from CMQMaster.cpp:2:
cppzmq/zmq.hpp: In member function ‘void zmq::context_t::close()’:
cppzmq/zmq.hpp:873:18: error: ‘zmq_ctx_term’ was not declared in this scope; did you mean ‘zmq_ctx_set’?
  873 |             rc = zmq_ctx_term(ptr);
      |                  ^~~~~~~~~~~~
      |                  zmq_ctx_set
cppzmq/zmq.hpp: In member function ‘void zmq::context_t::shutdown()’:
cppzmq/zmq.hpp:887:18: error: ‘zmq_ctx_shutdown’ was not declared in this scope; did you mean ‘zmq_ctx_set’?
  887 |         int rc = zmq_ctx_shutdown(ptr);
      |                  ^~~~~~~~~~~~~~~~
      |                  zmq_ctx_set
make: *** [/path/to/R-4.3.3/lib64/R/etc/Makeconf:200: CMQMaster.o] Error 1
ERROR: compilation failed for package ‘clustermq’
* removing ‘/home/alice/R/x86_64-pc-linux-gnu-library/4.3/clustermq’
* restoring previous ‘/home/alice/R/x86_64-pc-linux-gnu-library/4.3/clustermq’

The downloaded source packages are in
        '/tmp/alice/RtmpogYwlP/downloaded_packages'
Warning message:
In install.packages("clustermq") :
  installation of package 'clustermq' had non-zero exit status
$ yum info zeromq3-devel
Installed Packages
Name        : zeromq3-devel
Arch        : x86_64
Version     : 3.2.5
Release     : 1.el7
Size        : 93 k
Repo        : installed
From repo   : epel
Summary     : Development files for zeromq3
URL         : http://www.zeromq.org
License     : LGPLv3+ with exceptions
Description : The zeromq3-devel package contains libraries and header files for
            : developing applications that use zeromq3 3.x.
mschubert commented 7 months ago

This looks like a bug. Please use CLUSTERMQ_USE_SYSTEM_LIBZMQ=0 as a workaround:

Sys.setenv(CLUSTERMQ_USE_SYSTEM_LIBZMQ=0)
install.packages("clustermq")

The version should be checked here but the other compilation errors might trigger first:

https://github.com/mschubert/clustermq/blob/80984fcc4bf16d1004648dc273aefa440939e8c7/src/common.h#L12-L21

Proposed solution: add the version check to the test_libzmq.c check.

mschubert commented 7 months ago

@HenrikBengtsson I pushed a fix to master, would be great if you can check whether this works on your system now!

HenrikBengtsson commented 7 months ago

Thanks. I'm confirming that:

Sys.setenv(CLUSTERMQ_USE_SYSTEM_LIBZMQ=0)
install.packages("clustermq")

works for clustermq 0.9.4 currently on CRAN.

I'm also confirming the patch in master work out of the box in a fresh R session;

> remotes::install_github("mschubert/clustermq")
...
Installing package into '/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.3-CBI-gcc10'
(as 'lib' is unspecified)
* installing *source* package ‘clustermq’ ...
** using staged installation
* no system libzmq>=4.3.0 found -> using bundled libzmq
autoreconf: Entering directory `.'
...