File: 99-faq.tex

package info (click to toggle)
r-cran-pbdzmq 0.3.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 800 kB
  • sloc: ansic: 675; sh: 93; pascal: 30; makefile: 4
file content (93 lines) | stat: -rw-r--r-- 3,481 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

\section[FAQs]{FAQs}
\label{sec:faqs}
\addcontentsline{toc}{section}{\thesection. FAQs}


\subsection[ZeroMQ Errors]{ZeroMQ Errors}
\label{sec:zmq_errors}
\addcontentsline{toc}{subsection}{\thesubsection. ZeroMQ Errors}


\begin{enumerate}
\item {\bf\color{blue} Q:}
      If the package installs successfully, but fails at initialization with
\begin{Error}
error: unable to load shared object
'/Users/your_username/Library/R/3.2/library/pbdZMQ/libs/pbdZMQ.so':

dlopen(/.../R/3.2/library/pbdZMQ/libs/pbdZMQ.so, 6):
Library not loaded: /.../src/zmq/lib/libzmq.4.dylib

Referenced from: /.../R/3.2/library/pbdZMQ/libs/pbdZMQ.so
\end{Error}
or
\begin{Error}
Library not loaded: /usr/lib/libzmq.4.dylib
\end{Error}
or
\begin{Error}
Library not loaded: /usr/lib/libzmq.so.4.0.0
\end{Error}
      {\bf\color{blue} A:}
      From the ZeroMQ installation messages:
\begin{Code}
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
\end{Code}
    Further, for Mac OSX, the \code{otool} and \code{install_name_tool}
    commands are able to find and modify the linking path of \code{pbdZMQ.so}
    to the library \code{libzmq.4.dylib}.
    See the source of
    \code{pbdZMQ/src/install.libs.R} for how to change the linking path,
    accordingly. The basic steps are:
    \begin{enumerate}
    \item to use \code{otool -L pbdZMQ.so} to figure which
          \code{libzmq.4.dylib} is linked. Note that \code{pbdZMQ.so}
          should be the one in the installed directory, e.g. \\
          \code{/your_R_library_root_path/library/pbdZMQ/libs/pbdZMQ.so},
          and
    \item to use \code{install_name_tool -change org_dylib new_dylib pbdZMQ.so}
          to update to the right \code{new_dylib}, e.g. \\
          \code{/your_R_library_root_path/library/pbdZMQ/libs/libzmq.4.dylib}.
    \end{enumerate}
    For linux/unix, the \code{readelf}, \code{chrpath}, \code{pathelf},
    \code{ld.so}, and \code{/etc/ld.so.conf} (depending on systems and
    compilers) may serve the same roles as the \code{otool} and
    \code{install_name_tool} in Mac OSX.
\end{enumerate}




\subsection[ZeroMQ Flags]{ZeroMQ Flags}
\label{sec:zmq_flags}
\addcontentsline{toc}{subsection}{\thesubsection. ZeroMQ Flags}


\begin{enumerate}
\item {\bf\color{blue} Q:}
      How do I compile and link with ZeroMQ via \pkg{pbdZMQ} for my package
      which has \proglang{C/C++} code that call ZeroMQ functions?
      {\bf\color{blue} A:}
      There are two \pkg{pbdZMQ} functions: \code{get.zmq.cppflags()} and
      \code{get.zmq.ldflags()} that provide flags for compiling
      with ZMQ header files and linking against \code{libzmq.so} or
      \code{libzmq.dll}, respectivelly.
      Typically, these two functions will be envoked inside \code{Makevars}
      and \code{Makevars.win} via \code{Rscript -e '...'} to return the flags
      and append to whereever they are needed.

\end{enumerate}