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

Balamuta, James Joseph balamut2 at illinois.edu
Mon Mar 14 17:26:54 CET 2016

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:


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:


CXX= g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion



From: rcpp-devel-bounces at lists.r-forge.r-project.org [mailto:rcpp-devel-bounces at lists.r-forge.r-project.org] On Behalf Of aakremena at aol.com
Sent: Monday, March 14, 2016 10:01 AM
To: rcpp-devel at 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>

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.


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:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160314/3cb6105e/attachment.html>

More information about the Rcpp-devel mailing list