Greetings and Salutations,

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:

https://cran.r-project.org/doc/manuals/r-release/R-exts.html#OpenMP-support<https://cran.r-project.org/doc/manuals/r-release/R-exts.html%23OpenMP-support>

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. ( http://openmp.llvm.org/ , https://clang-omp.github.io/ )

If this is just for personal use, you may wish to set the ~/.R/Makevar 
information for R via:

https://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X-packages

VER=-4.8
CC=gcc$(VER)
CXX= g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-lgfortran

Sincerely,

JJB

From: rcpp-devel-boun...@lists.r-forge.r-project.org 
[mailto:rcpp-devel-boun...@lists.r-forge.r-project.org] On Behalf Of 
aakrem...@aol.com
Sent: Monday, March 14, 2016 10:01 AM
To: rcpp-devel@lists.r-forge.r-project.org
Subject: [Rcpp-devel] fatal error: 'omp.h' file not found

Dear Rcpp development list members,

I am trying to use OpenMP with Rcpp.  The code (placed in omp_experiment.cpp 
file) is pretty basic:

#include <RcppArmadillo.h>
#include <omp.h>

//[[Rcpp::plugins(openmp)]]
//[[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;

// [[Rcpp::export]]
int timesTwo(int x) {
   return x * 2;
}



Once I try to compile the file I get the error output

clang: warning: argument unused during compilation: '-fopenmp'
omp_experiment.cpp:2:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^
1 error generated.
make: *** [omp_experiment.o] Error 1
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
Error in 
Rcpp::sourceCpp("Documents/Business/MISO/R/Functions/Trading/Experiments/omp_experiment.cpp")
 :
  Error 1 occurred building shared library.

My QUESTION: How to configure OpenMP to work with Rcpp on my system?

I am working with RStudio, version 0.98.945 on Mac OS X Mavericks.

Every insight into this will be highly appreciated.

Thank you very much in advance.

Anguel


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
        locate "omp.h" command that proved that omp.h is indeed available in 4 
locations:

/usr/local/Cellar/gcc/5.3.0/lib/gcc/5/gcc/x86_64-apple-darwin13.2.0/5.3.0/include/omp.h
/usr/local/Cellar/gcc6/6-20160124/lib/gcc/6/gcc/x86_64-apple-darwin13.2.0/6.0.0/include/omp.h
/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/include/omp.h
/usr/local/lib/gcc/x86_64-apple-darwin13.1.0/4.9.0/include/omp.h
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to