| 1 |
|
| 2 |
\section[FAQs]{FAQs} |
| 3 |
\label{sec:faqs} |
| 4 |
\addcontentsline{toc}{section}{\thesection. FAQs} |
| 5 |
|
| 6 |
|
| 7 |
\subsection[ZeroMQ Errors]{ZeroMQ Errors} |
| 8 |
\label{sec:zmq_errors} |
| 9 |
\addcontentsline{toc}{subsection}{\thesubsection. ZeroMQ Errors} |
| 10 |
|
| 11 |
|
| 12 |
\begin{enumerate} |
| 13 |
\item {\bf\color{blue} Q:} |
| 14 |
If the package installs successfully, but fails at initialization with |
| 15 |
\begin{Error} |
| 16 |
error: unable to load shared object |
| 17 |
'/Users/your_username/Library/R/3.2/library/pbdZMQ/libs/pbdZMQ.so': |
| 18 |
|
| 19 |
dlopen(/.../R/3.2/library/pbdZMQ/libs/pbdZMQ.so, 6): |
| 20 |
Library not loaded: /.../src/zmq/lib/libzmq.4.dylib |
| 21 |
|
| 22 |
Referenced from: /.../R/3.2/library/pbdZMQ/libs/pbdZMQ.so |
| 23 |
\end{Error} |
| 24 |
or |
| 25 |
\begin{Error} |
| 26 |
Library not loaded: /usr/lib/libzmq.4.dylib |
| 27 |
\end{Error} |
| 28 |
or |
| 29 |
\begin{Error} |
| 30 |
Library not loaded: /usr/lib/libzmq.so.4.0.0 |
| 31 |
\end{Error} |
| 32 |
{\bf\color{blue} A:} |
| 33 |
From the ZeroMQ installation messages: |
| 34 |
\begin{Code} |
| 35 |
If you ever happen to want to link against installed libraries |
| 36 |
in a given directory, LIBDIR, you must either use libtool, and |
| 37 |
specify the full pathname of the library, or use the `-LLIBDIR' |
| 38 |
flag during linking and do at least one of the following: |
| 39 |
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable |
| 40 |
during execution |
| 41 |
- add LIBDIR to the `LD_RUN_PATH' environment variable |
| 42 |
during linking |
| 43 |
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag |
| 44 |
- have your system administrator add LIBDIR to `/etc/ld.so.conf' |
| 45 |
|
| 46 |
See any operating system documentation about shared libraries for |
| 47 |
more information, such as the ld(1) and ld.so(8) manual pages. |
| 48 |
\end{Code} |
| 49 |
Further, for Mac OSX, the \code{otool} and \code{install_name_tool} |
| 50 |
commands are able to find and modify the linking path of \code{pbdZMQ.so} |
| 51 |
to the library \code{libzmq.4.dylib}. |
| 52 |
See the source of |
| 53 |
\code{pbdZMQ/src/install.libs.R} for how to change the linking path, |
| 54 |
accordingly. The basic steps are: |
| 55 |
\begin{enumerate} |
| 56 |
\item to use \code{otool -L pbdZMQ.so} to figure which |
| 57 |
\code{libzmq.4.dylib} is linked. Note that \code{pbdZMQ.so} |
| 58 |
should be the one in the installed directory, e.g. \\ |
| 59 |
\code{/your_R_library_root_path/library/pbdZMQ/libs/pbdZMQ.so}, |
| 60 |
and |
| 61 |
\item to use \code{install_name_tool -change org_dylib new_dylib pbdZMQ.so} |
| 62 |
to update to the right \code{new_dylib}, e.g. \\ |
| 63 |
\code{/your_R_library_root_path/library/pbdZMQ/libs/libzmq.4.dylib}. |
| 64 |
\end{enumerate} |
| 65 |
For linux/unix, the \code{readelf}, \code{chrpath}, \code{pathelf}, |
| 66 |
\code{ld.so}, and \code{/etc/ld.so.conf} (depending on systems and |
| 67 |
compilers) may serve the same roles as the \code{otool} and |
| 68 |
\code{install_name_tool} in Mac OSX. |
| 69 |
\end{enumerate} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
\subsection[ZeroMQ Flags]{ZeroMQ Flags} |
| 75 |
\label{sec:zmq_flags} |
| 76 |
\addcontentsline{toc}{subsection}{\thesubsection. ZeroMQ Flags} |
| 77 |
|
| 78 |
|
| 79 |
\begin{enumerate} |
| 80 |
\item {\bf\color{blue} Q:} |
| 81 |
How do I compile and link with ZeroMQ via \pkg{pbdZMQ} for my package |
| 82 |
which has \proglang{C/C++} code that call ZeroMQ functions? |
| 83 |
{\bf\color{blue} A:} |
| 84 |
There are two \pkg{pbdZMQ} functions: \code{get.zmq.cppflags()} and |
| 85 |
\code{get.zmq.ldflags()} that provide flags for compiling |
| 86 |
with ZMQ header files and linking against \code{libzmq.so} or |
| 87 |
\code{libzmq.dll}, respectivelly. |
| 88 |
Typically, these two functions will be envoked inside \code{Makevars} |
| 89 |
and \code{Makevars.win} via \code{Rscript -e '...'} to return the flags |
| 90 |
and append to whereever they are needed. |
| 91 |
|
| 92 |
\end{enumerate} |
| 93 |
|