[Rcpp-devel] fatal error: 'omp.h' file not found

aakremena at aol.com aakremena at aol.com
Mon Mar 14 16:00:35 CET 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160314/e397a395/attachment.html>


More information about the Rcpp-devel mailing list