You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/Rcpp-FAQ.Rnw
+60-19Lines changed: 60 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -433,74 +433,112 @@ complain to its vendor if you are still upset.
433
433
\subsection{I am having problems building Rcpp on OS X, any help ?}
434
434
\label{q:OSX}
435
435
436
-
There are three known issues regarding Rcpp build problems on OS X. If you are building packages with RcppArmadillo, there is yet another issue that is addressed separately in \faq{q:OSXArma} below.
436
+
There are three known issues regarding Rcpp build problems on OS X. If you are
437
+
building packages with RcppArmadillo, there is yet another issue that is
438
+
addressed separately in \faq{q:OSXArma} below.
437
439
438
440
\subsubsection{Lack of a Compiler}
439
-
By default, OS X does not ship with an active compiler. To enable a compiler one must either install \href{https://itunes.apple.com/us/app/xcode/id497799835?mt=12}{Xcode} (OS X $\le10.8$) or \href{https://developer.apple.com/library/ios/technotes/tn2339/_index.html}{Xcode Command Line Tools} (OS X $\ge10.9$). We will focus on the later as the installation requires the use of \texttt{Terminal} and the install size is significantly less than the prior, which is setup using an installer.
441
+
By default, OS X does not ship with an active compiler. To enable a compiler one
442
+
must either install
443
+
\href{https://itunes.apple.com/us/app/xcode/id497799835?mt=12}{Xcode} (OS X
Command Line Tools} (OS X $\ge10.9$). We will focus on the later as the
447
+
installation requires the use of \texttt{Terminal} and the install size is
448
+
significantly less than the prior, which is setup using an installer.
440
449
441
450
To install XCode Command Line Tools, one must do the following:
442
451
443
452
\begin{enumerate}
444
453
\item Open \texttt{Terminal} found in \texttt{/Applications/Utilities/}
445
454
\item Type the following:
446
-
<<osx_xcode,engine='bash', eval = F>>=
455
+
456
+
<<lang=bash>>=
447
457
$xcode-select--install
448
458
@
449
459
\item Press "Install" on the window that pops up.
450
460
\item After the installation is complete, type the following in \texttt{Terminal} to ensure the installation was successful:
451
461
452
-
<<osx_xcode_gcc,engine='bash', eval = F>>=
462
+
<<lang=bash>>=
453
463
$gcc--version
454
464
@
455
465
\end{enumerate}
456
466
457
-
After major system's update, e.g. 10.11 to 10.12, you may need to accept the terms and licenses associated the the Xcode command line tools prior to being allowed to compile again.
467
+
After major system updates, e.g. going from version 10.11 to 10.12, you may need
468
+
to accept the terms and licenses associated the the Xcode command line tools
469
+
prior to being allowed to compile again.
458
470
459
471
To do so, open the \texttt{Terminal} found in \texttt{/Applications/Utilities/} and type:
460
472
461
-
<<osx_xcode_git,engine='bash', eval = F>>=
473
+
<<lang=bash>>=
462
474
$git
463
475
@
464
476
465
-
Press spacebar to move down to the end of the file. There, you should see a prompt asking whether or not you accept the terms via either "Yes" or "No". Enter "Yes" if you agree to the terms to have the command line tools reactivated.
477
+
Press spacebar to move down to the end of the file. There, you should see a
478
+
prompt asking whether or not you accept the terms via either "Yes" or
479
+
"No". Enter "Yes" if you agree to the terms to have the command line tools
480
+
reactivated.
466
481
467
482
\subsubsection{Differing Mac OS X R Versions Leading to Binary Failures}
468
483
469
-
There are currently two distinct versions of R for OS X. The first version is a legacy version meant for Mac OS X 10.6 (Snow Leopard) - 10.8 (Mountain Lion). The second version is for more recent system Mac OS X 10.9 (Mavericks), 10.10 (Yosemite), 10.11 (El Capitan). The distinction comes as a result of a change in the compilers shipped with the operating system. As a result, avoid sending package binaries if it is known that your collaborators are working on older systems as the R binaries for these two versions will not be able to mix.
484
+
There are currently two distinct versions of R for OS X. The first version is a
485
+
legacy version meant for Mac OS X 10.6 (Snow Leopard) - 10.8 (Mountain
486
+
Lion). The second version is for more recent system Mac OS X 10.9 (Mavericks),
487
+
10.10 (Yosemite), 10.11 (El Capitan). The distinction comes as a result of a
488
+
change in the compilers shipped with the operating system. As a result, avoid
489
+
sending package binaries if it is known that your collaborators are working on
490
+
older systems as the R binaries for these two versions will not be able to mix.
470
491
471
492
\subsubsection{No OpenMP Support}
472
-
The OS X operating environment lacks the ability to parallelize sections of code using the \href{http://openmp.org/wp/}{OpenMP} standard. As a result, make sure to protect any reference to OpenMP. In this case, protect the inclusion of headers with:
493
+
The OS X operating environment lacks the ability to parallelize sections of code
494
+
using the \href{http://openmp.org/wp/}{OpenMP} standard. As a result, make sure
495
+
to protect any reference to OpenMP. In this case, protect the inclusion of
496
+
headers with:
473
497
474
-
<<osx_openmp_header, engine="Rcpp", eval = F>>=
498
+
<<lang=cpp>>=
475
499
#ifdef _OPENMP
476
500
#include <omp.h>
477
501
#endif
478
502
@
479
503
480
504
And when one goes to parallelize portions of code use:
481
505
482
-
<<osx_openmp_code, engine="Rcpp", eval = F>>=
506
+
<<lang=cpp>>=
483
507
#ifdef _OPENMP
484
508
//multithreadedOpenMPversionofcode
485
509
#else
486
510
//single-threadedversionofcode
487
511
#endif
488
512
@
489
513
490
-
Doing so will enable the parallelization of the process on Linux and Windows. In the event that Apple enables OpenMP later on, this code will also allow for parallelization to occur.
514
+
Doing so will enable the parallelization of the process on Linux and Windows. In
515
+
the event that Apple enables OpenMP later on, this code will also allow for
516
+
parallelization to occur.
491
517
492
-
The reason for the lack of OpenMP support is because under OS X, you are not using the \texttt{gcc} compiler. Instead, all the requests are being redirected to \texttt{llvm}. As of LLVM 3.7, the \href{https://clang-omp.github.io/}{community initiative} to enable OpenMP has been merged into the \href{http://openmp.llvm.org/}{official branch}. Thus, there is hope in the next release of Xcode (around WWDC in June 2016) that OpenMP will work on OS X.
518
+
The reason for the lack of OpenMP support is because under OS X, you are not
519
+
using the \texttt{gcc} compiler. Instead, all the requests are being redirected
520
+
to \texttt{llvm}. As of LLVM 3.7, the
521
+
\href{https://clang-omp.github.io/}{community initiative} to enable OpenMP has
522
+
been merged into the \href{http://openmp.llvm.org/}{official branch}. Thus,
523
+
there is hope in the next release of Xcode (around WWDC in June 2016) that
524
+
OpenMP will work on OS X.
493
525
494
526
495
527
\subsubsection{Additional Information / Help}
496
528
497
529
Below are additional resources that provide information regarding compiling Rcpp code on OS X.
498
530
499
531
\begin{enumerate}
500
-
\item A helpful post was provided by Brian Ripley regarding the use of compiling R code with OS X in April 2014 \href{https://stat.ethz.ch/pipermail/r-sig-mac/2014-April/010835.html}{on the \code{r-sig-mac} list}, which is generally recommended for OS X-specific questions and further consultation.
501
-
\item Another helpful write-up for installation / compilation on OS X Mavericks is
502
-
provided \href{http://www.bioconductor.org/developers/how-to/mavericks-howto/}{by the BioConductor project}.
503
-
\item Lastly, another resource that exists for installation / compilation help is provided at \url{http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-os-x/}.
532
+
\item A helpful post was provided by Brian Ripley regarding the use of
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}.
@@ -634,7 +674,8 @@ of paths suitable to be passed to \code{FLIBS}. \R will then search
634
674
these paths when attempting to locate e.g \code{libgfortran} when
635
675
compiling \pkg{RcppArmadillo} or other FORTRAN-dependent code.
636
676
637
-
Also see \faq{q:OSX} above, and the links provided in that answer. In the event the above solution does not satisfy all the OS X build problems.
677
+
Also see \faq{q:OSX} above, and the links provided in that answer. In the event
678
+
the above solution does not satisfy all the OS X build problems.
0 commit comments