Debian Codegraph @

vignettes/pbdZMQ-include/02-installation.tex

raw
1 \section[Installation]{Installation}
2 \label{sec:installation}
3 \addcontentsline{toc}{section}{\thesection. Installation}
4
5
6 \subsection{Installing}
7
8 The \pkg{pbdZMQ} package requires an installation of the ZeroMQ library. So
9 before we may discuss particulars of installing the \proglang{R} package, we
10 take a moment here to describe the various ways in which you may install ZeroMQ
11 itself. For convenience, we distribute with the package a distribution of
12 ZeroMQ, although if you have access to a system installation, that may be
13 preferable. We separate installation of ZeroMQ into 3 cases:
14 \begin{enumerate}
15 \item system package manager, such as the \code{libzmq} and
16 \code{libzmq-dev} packages in Debian-derived systems,
17 \item \pkg{pbdZMQ}'s internal ZeroMQ library (4.1.0 rc1), or
18 \item an external ZeroMQ library (4.1.0 rc1 or later).
19 \end{enumerate}
20
21
22 \paragraph{With System Package Manager}
23
24 This method is perhaps the easiest when a package managing system is available,
25 such as on Linux, and returns the locations of the \code{libzmq} include and
26 library paths via:
27 \begin{itemize}
28 \item \code{pkg-config --variable=includedir libzmq} and
29 \item \code{pkg-config --variable=libsdir libzmq}.
30 \end{itemize}
31 In this setup, installation is very straightforward. From a shell, you can
32 execute:
33 \begin{Command}
34 R CMD INSTALL pbdZMQ_0.1-0.tar.gz
35 \end{Command}
36
37
38
39 \paragraph{Using Internal ZeroMQ}
40
41 This method uses the ZeroMQ library bundled with \pkg{pbdZMQ}, and should be
42 fairly simple. This method has been successfully tested under Linux, Mac OSX,
43 Windows, and FreeBSD. Solaris has been tested with no success.
44
45 Installation in this way can be simply done by adding the configure argument
46 \code{--enable-internal-zmq}. In practice, this might look something like:
47 \begin{Command}
48 R CMD INSTALL pbdZMQ_0.1-0.tar.gz \
49 --configure-args="--enable-internal-zmq"
50 \end{Command}
51
52
53 \paragraph{Using External ZeroMQ}
54
55 This method assumes you have built your own ZeroMQ library somewhere, or
56 perhaps one is offered to you by your system administrator. In any event,
57 this method is only tested under Linux systems. As with the previous method,
58 we were unsuccessful in our attempts to build on Solaris.
59
60 To build ZeroMQ yourself, you might do something like the following:
61 \begin{Command}
62 ./configure \
63 --prefix=/usr/local/zmq \
64 --enable-shared=yes \
65 --with-poller=select \
66 --without-documentation \
67 --without-libsodium
68 make -j 4
69 make install
70 \end{Command}
71 which will install the library to \code{/usr/local/zmq/} where
72 \code{/usr/local/zmq/include/} will have the header file \code{zmq.h} and
73 \code{/usr/local/zmq/lib/} will have the shared library file \code{libzmq.so}.
74
75 With an external ZeroMQ available, we can install \pkg{pbdZMQ} via:
76 \begin{Command}
77 R CMD INSTALL pbdZMQ_0.1-0.tar.gz \
78 --configure-vars="ZMQ_INCLUDE='-I/usr/local/zmq/include' \
79 ZMQ_LDFLAGS='-L/usr/local/zmq/lib -lzmq'"
80 \end{Command}
81
82
83
84 \subsection{Testing the Installation}
85
86 To make sure that \pkg{pbdZMQ} is installed correctly, one may run a simple
87 ``hello world'' test from {\em one} terminal to test the library as follows:
88 \begin{Command}
89 Rscript -e "demo(hwserver,'pbdZMQ',ask=F,echo=F)" &
90 Rscript -e "demo(hwclient,'pbdZMQ',ask=F,echo=F)"
91 \end{Command}
92 This will run 5 iterations of sending and receiving 'Hello World' messages
93 between two instances (simple server and client).
94
95
96
97 \subsection{Polling System}
98
99 Note that one may want to use different polling system provided by
100 the ZeroMQ library. By default, the \code{select} method is used in
101 \pkg{pbdZMQ} for Linux, Windows, and Mac OSX. However, users may want to use
102 \code{autodetect} or try others for better polling. Currently, the options as
103 given by ZeroMQ may be \code{kqueue}, \code{epoll}, \code{devpoll},
104 \code{poll}, or \code{select} depending on libraries and system. You may set
105 the polling method at compile time via:
106 \begin{Command}
107 R CMD INSTALL pbdZMQ_0.1-0.tar.gz \
108 --configure-vars="ZMQ_POLLER='autodetect'"
109 \end{Command}
110 See the ZeroMQ manual for more details.