@@ -435,78 +435,59 @@ Studio simply do not get along. As \pkg{Rcpp} is all about extending
435435toolchain. And \proglang {R} simply does not compile with Visual Studio. Go
436436complain to its vendor if you are still upset.
437437
438- \subsection {I am having problems building Rcpp on OS X , any help ? }
438+ \subsection {I am having problems building Rcpp on macOS , any help ? }
439439\label {q:OSX }
440440
441- There are three known issues regarding Rcpp build problems on OS X . If you are
441+ There are three known issues regarding Rcpp build problems on macOS . If you are
442442building packages with RcppArmadillo, there is yet another issue that is
443443addressed separately in \faq {q:OSXArma} below.
444444
445445\subsubsection {Lack of a Compiler }
446- By default, OS X does not ship with an active compiler. To enable a compiler one
447- must either install
448- \href {https://itunes.apple.com/us/app/xcode/id497799835?mt=12}{Xcode} (OS X
449- $ \le 10.8 $ ) or
450- \href {https://developer.apple.com/library/ios/technotes/tn2339/_index.html}{Xcode
451- Command Line Tools} (OS X $ \ge 10.9 $ ). We will focus on the later as the
452- installation requires the use of \texttt {Terminal } and the install size is
453- significantly less than the prior, which is setup using an installer.
454446
455- To install XCode Command Line Tools, one must do the following:
456-
457- \begin {enumerate }
458- \item Open \texttt {Terminal } found in \texttt {/Applications/Utilities/ }
459- \item Type the following:
460-
461- <<lang =bash >>=
462- $ xcode - select -- install
463- @
464- \item Press "Install" on the window that pops up.
465- \item After the installation is complete, type the following in \texttt {Terminal } to ensure the installation was successful:
466-
467- <<lang =bash >>=
468- $ gcc -- version
469- @
470- \end {enumerate }
471-
472- After major system updates, e.g. going from version 10.11 to 10.12, you may need
473- to accept the terms and licenses associated the the Xcode command line tools
474- prior to being allowed to compile again.
475-
476- To do so, open the \texttt {Terminal } found in \texttt {/Applications/Utilities/ } and type:
477-
478- <<lang =bash >>=
479- $ git
480- @
481-
482- Press spacebar to move down to the end of the file. There, you should see a
483- prompt asking whether or not you accept the terms via either "Yes" or
484- "No" . Enter "Yes" if you agree to the terms to have the command line tools
485- reactivated.
486-
487- \subsubsection {Differing Mac OS X R Versions Leading to Binary Failures }
488-
489- There are currently two distinct versions of R for OS X. The first version is a
490- legacy version meant for Mac OS X 10.6 (Snow Leopard) - 10.8 (Mountain
491- Lion). The second version is for more recent system Mac OS X 10.9 (Mavericks),
492- 10.10 (Yosemite), 10.11 (El Capitan). The distinction comes as a result of a
493- change in the compilers shipped with the operating system. As a result, avoid
494- sending package binaries if it is known that your collaborators are working on
495- older systems as the R binaries for these two versions will not be able to mix.
496-
497- \subsubsection {No OpenMP Support }
498- The OS X operating environment lacks the ability to parallelize sections of code
499- using the \href {http://openmp.org/wp/}{OpenMP} standard. As a result, make sure
500- to protect any reference to OpenMP. In this case, protect the inclusion of
501- headers with:
447+ By default, macOS does not ship with an active compiler. Depending on the
448+ \proglang {R} version being used, there are different development environment
449+ setup procedures. For the current \proglang {R} version, we recommend observing
450+ the official procedure used in
451+ \href {https://cran.r-project.org/doc/manuals/r-release/R-admin.html#macOS-packages}{Section 6.3.2 macOS}
452+ and \href {https://cran.r-project.org/doc/manuals/r-release/R-admin.html#macOS}{Section C.3 macOS}
453+ of the \href {https://cran.r-project.org/doc/manuals/r-release/R-admin.html}{R Installation and Administration}
454+ manual.
455+
456+ \subsubsection {Differing macOS R Versions Leading to Binary Failures }
457+
458+ There are currently \textit {three } distinct versions of R for macOS.
459+ The first version is a legacy version meant for macOS 10.6 (Snow Leopard) -
460+ 10.8 (Mountain Lion). The second version is for more recent system
461+ macOS 10.9 (Mavericks) and 10.10 (Yosemite). Finally, the third and most
462+ up-to-date version supports macOS 10.11 (El Capitan), 10.12 (Sierra), and 10.13 (High Sierra).
463+ The distinction comes as a result of a change in the compilers shipped with the
464+ operating system as highlighted previously. As a result, avoid sending
465+ \textbf {package binaries } to collaborators if they are working on older
466+ operating systems as the \proglang {R} binaries for these versions will not be
467+ able to mix. In such cases, it is better to provide collaborators with the
468+ \textbf {package source } and allow them to build the package locally.
469+
470+ \subsubsection {OpenMP Support }
471+
472+ By default, the macOS operating environment lacks the ability to parallelize
473+ sections of code using the \proglang {\href {http://openmp.org/wp/}{OpenMP}}
474+ standard. Within \proglang {R} 3.4.*, the default developer environment was
475+ \textit {changed } to allow for \proglang {OpenMP} to be used on macOS by using
476+ a non-default toolchain provided by R Core Team maintainers for macOS.
477+ Having said this, it is still important to protect any reference to
478+ \proglang {OpenMP} as some users may not yet have the ability to
479+ use \proglang {OpenMP}.
480+
481+ To setup the appropriate protection for using \proglang {OpenMP}, the process
482+ is two-fold. First, protect the inclusion of headers with:
502483
503484<<lang =cpp >>=
504485# ifdef _OPENMP
505486 # include <omp.h>
506487# endif
507488@
508489
509- And when one goes to parallelize portions of code use:
490+ Second, when parallelizing portions of code use:
510491
511492<<lang =cpp >>=
512493# ifdef _OPENMP
@@ -516,26 +497,16 @@ And when one goes to parallelize portions of code use:
516497# endif
517498@
518499
519- Doing so will enable the parallelization of the process on Linux and Windows. In
520- the event that Apple enables OpenMP later on, this code will also allow for
521- parallelization to occur.
522-
523- The reason for the lack of OpenMP support is because under OS X, you are not
524- using the \texttt {gcc } compiler. Instead, all the requests are being redirected
525- to \texttt {llvm }. As of LLVM 3.7, the
526- \href {https://clang-omp.github.io/}{community initiative} to enable OpenMP has
527- been merged into the \href {http://openmp.llvm.org/}{official branch}. Thus,
528- there is hope in the next release of Xcode (around WWDC in June 2016) that
529- OpenMP will work on OS X.
530-
500+ Under this approach, the code will be \textit {safely } parallelized when
501+ support exists for \proglang {OpenMP} on Windows, macOS, and Linux.
531502
532- \subsubsection {Additional Information / Help }
503+ \subsubsection {Additional Information and Help }
533504
534- Below are additional resources that provide information regarding compiling Rcpp code on OS X .
505+ Below are additional resources that provide information regarding compiling Rcpp code on macOS .
535506
536507\begin {enumerate }
537508 \item A helpful post was provided by Brian Ripley regarding the use of
538- compiling R code with OS X in April 2014
509+ compiling R code with macOS in April 2014
539510 \href {https://stat.ethz.ch/pipermail/r-sig-mac/2014-April/010835.html}{on
540511 the \code {r-sig-mac} list}, which is generally recommended for OS
541512 X-specific questions and further consultation.
@@ -546,7 +517,7 @@ Below are additional resources that provide information regarding compiling Rcpp
546517 \url {http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-os-x/}.
547518\end {enumerate }
548519
549- \textbf {Note: } If you are running into trouble compiling code with RcppArmadillo, please also see \faq {q:OSXArma} listed below.
520+ \textbf {Note: } If you are running into trouble compiling code with \pkg { RcppArmadillo} , please also see \faq {q:OSXArma} listed below.
550521
551522% At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp}
552523% (just like CRAN) supports all OS X releases greater or equal to 10.5.
@@ -611,76 +582,26 @@ But for most packages using \pkg{Rcpp}, only two things are required:
611582The name of the symbol does not really matter; once one symbol is imported all
612583symbols should be available.
613584
614- \subsection {I am having problems building RcppArmadillo on OS X , any help ? }
585+ \subsection {I am having problems building RcppArmadillo on macOS , any help ? }
615586\label {q:OSXArma }
616587
617588Odds are your build failures are due to the absence of \texttt {gfortran }
618589and its associated libraries. The errors that you may receive are related to either:
590+
619591\begin {center }
620592\textbf {`` -lgfortran'' } or \textbf {`` -lquadmath'' }
621593\end {center }
622594
623- To rectify the root of these errors, there are two options available. The first option is to download and use a fixed set of \texttt {gfortran } binaries that are used to compile R for OS X (e.g. given by the maintainers of the OS X build). The second option is to either use pre-existing \texttt {gfortran } binaries on your machine or download the latest.
624-
625- \subsubsection {Fixed set of \texttt {gfortran } binaries }
626-
627- Within this option, you will install a pre-compiled \code {gfortran} binary from
628- \href {http://r.research.att.com/libs/}{\texttt {r.research.att.com/libs/ }}. The binary listed here was compiled by Simon Urbanek the maintainer of the OS X R versions.
629-
630- To install the pre-compiled \code {gfortran} binary, do the following:
631- \begin {enumerate }
632- \item Open \texttt {Terminal } found in \texttt {/Applications/Utilities/ }
633- \item Type the following:
634-
635- <<lang =bash >>=
636- curl - O http : // r.research.att.com / libs / gfortran - 4.8.2 - darwin13.tar.bz2
637- sudo tar fvxz gfortran - 4.8.2 - darwin13.tar.bz2 - C /
638- @
639-
640- \end {enumerate }
641-
642- For more information on this error, please see TheCoatlessProfessor's \href {http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/}{Rcpp, RcppArmadillo and OS X Mavericks "-lgfortran" and "-lquadmath" error}.
643-
644- \subsubsection {Pre-existing or latest \texttt {gfortran } binaries }
645-
646- Most OS X users that have a pre-existing \texttt {gfortran } binaries or want the latest version, typically use a custom packaging solution to install \texttt {gfortran };
647- \href {https://www.macports.org/}{\texttt {macports }},
648- \href {http://brew.sh/}{\texttt {homebrew }}, and
649- \href {http://www.finkproject.org/}{\texttt {fink }} are the usual suspects
650- here. In general, we recommend using homebrew, and we provide a short
651- set of instructions for installing \texttt {gfortran } below.
652-
653- After installing \texttt {homebrew } by
654- \href {http://brew.sh/}{following the instructions here},
655- you can install the latest version of \texttt {gfortran } with:
656-
657- \code {brew install gcc}
658-
659- Note that \texttt {gfortran } is available as part of the \texttt {gcc }
660- 'formula' by default and cannot be downloaded separately, but one can
661- freely use \texttt {gfortran } with Apple (or LLVM) \texttt {clang }
662- compilers (as used by default on OS X since Mavericks).
663-
664- You may need to set the \code {FLIBS} variable in your
665- \texttt {~/.R/Makevars } to point to the location of the \texttt {gfortran }
666- library paths. A solution is outlined
667- \href {http://stackoverflow.com/questions/29992066/rccp-warning-directory-not-found-for-option-l-usr-local-cellar-gfortran-4-8/29993906#29993906}{on
668- StackOverflow}, but the relevant details are copied in brief here.
669-
670- In short, you want to add this entry to your \texttt {~/.R/Makevars }:
671-
672- <<lang =bash >>=
673- FLIBS = `gfortran -print-search-dirs | grep ^libraries: | sed 's|libraries: =||' | sed 's|:| -L|g' | sed 's|^|-L|'`
674- @
675-
676- This invocation explicitly asks and constructs the library link paths
677- from the \texttt {gfortran }'s reported search paths, and produces a set
678- of paths suitable to be passed to \code {FLIBS}. \R will then search
679- these paths when attempting to locate e.g \code {libgfortran} when
680- compiling \pkg {RcppArmadillo} or other FORTRAN-dependent code.
681-
682- Also see \faq {q:OSX} above, and the links provided in that answer. In the event
683- the above solution does not satisfy all the OS X build problems.
595+ To rectify the root of these errors, there are two options available. The first
596+ option is to download and use a fixed set of \texttt {gfortran } binaries that are
597+ used to compile R for macOS (e.g. given by the maintainers of the macOS build).
598+ The second option is to either use pre-existing \texttt {gfortran } binaries on
599+ your machine or download the latest. These options are described in-depth
600+ in \href {https://cran.r-project.org/doc/manuals/r-release/R-admin.html#macOS}{Section C.3 macOS}
601+ of the \href {https://cran.r-project.org/doc/manuals/r-release/R-admin.html}{R Installation and Administration}
602+ manual. Please consult this manual for up-to-date information regarding \texttt {gfortran }
603+ binaries on macOS. We have also documented \textit {other } common macOS compile
604+ issues in Section \faq {q:OSX}.
684605
685606\section {Examples }
686607
@@ -1209,7 +1130,7 @@ This is what is currently supported:
12091130\item Matrix types instantiated using the rows, cols constructor \code {Rcpp::<Type>Matrix n(rows,cols)}
12101131\begin {itemize }
12111132\item \code {CharacterMatrix}, \code {IntegerMatrix}, and
1212- \code {NumericMatrix})
1133+ \code {NumericMatrix}
12131134\end {itemize }
12141135\end {itemize }
12151136
0 commit comments