|
27 | 27 | \newcommand{\proglang}[1]{\textsf{#1}} |
28 | 28 | \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} |
29 | 29 | \newcommand{\code}[1]{\texttt{#1}} |
| 30 | +\newcommand{\R}[0]{\proglang{R}} |
30 | 31 |
|
31 | 32 | %% defined as a stop-gap measure til interaction with highlight is sorted out |
32 | 33 | \newcommand{\hlboxlessthan}{ \hlnormalsizeboxlessthan} |
@@ -515,12 +516,56 @@ should be available. |
515 | 516 | \subsection{I am having problems building RcppArmadillo on OS X, any help ?} |
516 | 517 | \label{q:OSXArma} |
517 | 518 |
|
518 | | -For recent OS X versions Mavericks and beyond, you need to install the additional |
519 | | -\href{http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2}{gfortran 4.8.2 for Darwin 13} |
520 | | -package from \href{http://r.research.att.com/libs/}{the |
521 | | - \texttt{r.research.att.com} site} maintained by Simon. |
522 | | -See \href{http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error}{this |
523 | | -post for details}. |
| 519 | +Odds are your build failures are due to the absense of \texttt{gfortran} |
| 520 | +and its associated libraries. Alternatively, you have them installed, |
| 521 | +but \R simply doesn't know how to locate them. |
| 522 | + |
| 523 | +While \texttt{gfortran} is distributed as part of \texttt{gcc} and hence |
| 524 | +is available by default on most Linux distributions, it is not |
| 525 | +distributed as part of Apple's command line tools. So, unfortunately, |
| 526 | +you're going to need to install \texttt{gfortran} and its associated |
| 527 | +libraries yourself. |
| 528 | + |
| 529 | +Most OS X users have opted into using a custom packaging solution; |
| 530 | +\href{https://www.macports.org/}{\texttt{macports}}, |
| 531 | +\href{http://brew.sh/}{\texttt{homebrew}}, and |
| 532 | +\href{http://www.finkproject.org/}{\texttt{fink}} are the usual suspects |
| 533 | +here. In general, we recommend using homebrew, and we provide a short |
| 534 | +set of instructions for installing \texttt{gfortran} below. |
| 535 | + |
| 536 | +After installing \texttt{homebrew} by |
| 537 | +\href{http://brew.sh/}{following the instructions here}, |
| 538 | +you can install the latest version of \texttt{gfortran} with: |
| 539 | + |
| 540 | + \code{brew install gcc} |
| 541 | + |
| 542 | +Note that \texttt{gfortran} is available as part of the \texttt{gcc} |
| 543 | +'formula' by default and cannot be downloaded separately, but one can |
| 544 | +freely use \texttt{gfortran} with Apple (or LLVM) \texttt{clang} |
| 545 | +compilers (as used by default on OS X since Mavericks). |
| 546 | + |
| 547 | +You may need to set the \code{FLIBS} variable in your |
| 548 | +\texttt{~/.R/Makevars} to point to the location of the \texttt{gfortran} |
| 549 | +library paths. A solution is outlined |
| 550 | +\href{http://stackoverflow.com/questions/29992066/rccp-warning-directory-not-found-for-option-l-usr-local-cellar-gfortran-4-8/29993906#29993906}{on |
| 551 | + StackOverflow}, but the relevant details are copied in brief here. |
| 552 | + |
| 553 | +In short, you want to add this entry to your \texttt{~/.R/Makevars}: |
| 554 | + |
| 555 | +\begin{verbatim} |
| 556 | +FLIBS=`gfortran -print-search-dirs | grep ^libraries: | sed 's|libraries: =||' | sed 's|:| -L|g' | sed 's|^|-L|'` |
| 557 | +\end{verbatim} |
| 558 | + |
| 559 | +This invocation explicitly asks and constructs the library link paths |
| 560 | +from the \texttt{gfortran}'s reported search paths, and produces a set |
| 561 | +of paths suitable to be passed to \code{FLIBS}. \R will then search |
| 562 | +these paths when attempting to locate e.g \code{libgfortran} when |
| 563 | +compiling \pkg{RcppArmadillo} or other FORTRAN-dependent code. |
| 564 | + |
| 565 | +You can also install a pre-compiled \code{gfortran} binary from |
| 566 | +\href{http://r.research.att.com/libs/}{\textt{r.research.att.com/libs/}} |
| 567 | +-- this is a collection of libraries compiled by Simon Urbanek known |
| 568 | +to be compatible with recent releases of \R. |
524 | 569 |
|
525 | 570 | Also see \faq{q:OSX} above, and the links provided in that answer. |
526 | 571 |
|
|
0 commit comments