<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Greetings and Salutations,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">OS X does not currently support OpenMP under the default compiler (clang). Hence, you are receiving an error as it relates to the header file not being found. For more details,
 see:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><a href="https://cran.r-project.org/doc/manuals/r-release/R-exts.html%23OpenMP-support">https://cran.r-project.org/doc/manuals/r-release/R-exts.html#OpenMP-support</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Support for OpenMP with clang should be arriving sometime in June after WWDC as the intel funded clang-OpenMP feature has been merged into the main clang branch. (
<a href="http://openmp.llvm.org/">http://openmp.llvm.org/</a> , <a href="https://clang-omp.github.io/">
https://clang-omp.github.io/</a> )<br>
<br>
If this is just for personal use, you may wish to set the ~/.R/Makevar information for R via:<br>
<br>
<a href="https://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X-packages">https://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X-packages</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
VER=-4.8 <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">CC=gcc$(VER)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">CXX=</span>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">g++$(VER)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">FLIBS=-lgfortran<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Sincerely,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">JJB<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> rcpp-devel-bounces@lists.r-forge.r-project.org [mailto:rcpp-devel-bounces@lists.r-forge.r-project.org]
<b>On Behalf Of </b>aakremena@aol.com<br>
<b>Sent:</b> Monday, March 14, 2016 10:01 AM<br>
<b>To:</b> rcpp-devel@lists.r-forge.r-project.org<br>
<b>Subject:</b> [Rcpp-devel] fatal error: 'omp.h' file not found<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">Dear Rcpp development list members,<br>
<br>
I am trying to use OpenMP with Rcpp.  The code (placed in omp_experiment.cpp file) is pretty basic:<br>
<br>
#include <RcppArmadillo.h><br>
#include <omp.h><br>
<br>
//[[Rcpp::plugins(openmp)]]<br>
//[[Rcpp::depends(RcppArmadillo)]]<br>
using namespace Rcpp;<br>
<br>
// [[Rcpp::export]]<br>
int timesTwo(int x) {<br>
   return x * 2;<br>
}<br>
<br>
<br>
<br>
Once I try to compile the file I get the error output<br>
<br>
clang: warning: argument unused during compilation: '-fopenmp'<br>
omp_experiment.cpp:2:10: fatal error: 'omp.h' file not found<br>
#include <omp.h><br>
         ^<br>
1 error generated.<br>
make: *** [omp_experiment.o] Error 1<br>
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include  -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include"
 -I"/Users/anguelgrigorov/Documents/Business/MISO/R/Functions/Trading/Experiments"   -fopenmp  -fPIC  -Wall -mtune=core2 -g -O2  -c omp_experiment.cpp -o omp_experiment.o<br>
Error in Rcpp::sourceCpp("Documents/Business/MISO/R/Functions/Trading/Experiments/omp_experiment.cpp") :
<br>
  Error 1 occurred building shared library.<br>
<br>
<b>My QUESTION: How to configure OpenMP to work with Rcpp on my system?</b><br>
<br>
I am working with RStudio, version 0.98.945 on Mac OS X Mavericks.<br>
<br>
Every insight into this will be highly appreciated.<br>
<br>
Thank you very much in advance.<br>
<br>
Anguel<br>
<br>
<br>
P.S. I've done some reading on the Internet that advised me to check whether omp.h is even available on my laptop (MacBook Pro).  I have used OS X
<br>
        locate "omp.h" command that proved that omp.h is indeed available in 4 locations:<br>
<br>
/usr/local/Cellar/gcc/5.3.0/lib/gcc/5/gcc/x86_64-apple-darwin13.2.0/5.3.0/include/omp.h<br>
/usr/local/Cellar/gcc6/6-20160124/lib/gcc/6/gcc/x86_64-apple-darwin13.2.0/6.0.0/include/omp.h<br>
/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/include/omp.h<br>
/usr/local/lib/gcc/x86_64-apple-darwin13.1.0/4.9.0/include/omp.h</span><o:p></o:p></p>
</div>
</body>
</html>