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

aakremena at aol.com aakremena at aol.com
Mon Mar 14 17:45:49 CET 2016

Hi James and Kevin,

Thank you very much for the advices (I'll try James' directions shortly).

But I have already installed clang-omp via

                    $ brew install clang-omp

The compiler is available at /usr/local/Library/Formula/clang-omp.rb

Can I ask you for some directions as to how to configure clang-omp with RStudio (if possible), i.e. how to make R recognize clang-omp?

Thank you in advance.





-----Original Message-----
From: Kevin Thornton <krthornt at uci.edu>
To: rcpp-devel at lists.r-forge.r-project.org <rcpp-devel at r-forge.wu-wien.ac.at>
Sent: Mon, Mar 14, 2016 11:33 am
Subject: Re: [Rcpp-devel] fatal error: 'omp.h' file not found

One may also use clang-omp from Homebrew if you wish to still use clang on OS X, but have OpenMP.


On Mon, Mar 14, 2016 at 9:31 AM Balamuta, James Joseph <balamut2 at illinois.edu> wrote:

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:


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:


Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org

Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160314/65a19ab2/attachment.html>

More information about the Rcpp-devel mailing list