I'm running RServer Studio on a Linux box on AWS.
I tried to install ModelMetrics
, a dependency for caret
, and received this error:
auc_.cpp:2:10: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
make: *** [auc_.o] Error 1
ERROR: compilation failed for package ‘ModelMetrics’
This is the full output message
Installing package into ‘/home/User/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ModelMetrics_1.2.2.tar.gz'
Content type 'application/x-gzip' length 16974 bytes (16 KB)
==================================================
downloaded 16 KB
* installing *source* package ‘ModelMetrics’ ...
** package ‘ModelMetrics’ successfully unpacked and MD5 sums checked
** libs
g++ -I"/opt/R/3.5.3/lib64/R/include" -DNDEBUG -I"/home/User/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -I"/opt/R/3.5.3/lib64/R/include" -DNDEBUG -I"/home/User/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include -fpic -g -O2 -c auc_.cpp -o auc_.o
auc_.cpp:2:10: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
make: *** [auc_.o] Error 1
ERROR: compilation failed for package ‘ModelMetrics’
* removing ‘/home/User/R/x86_64-pc-linux-gnu-library/3.5/ModelMetrics’
Warning in install.packages :
installation of package ‘ModelMetrics’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmpr06k8i/downloaded_packages’
I looked around SO and it looks like there is an error with the compiler. I tried the solutions listed here, specifically I ran these commands
yum groupinstall 'Development Tools'
mkdir ~/.R
echo "CC=gcc64" >> ~/.R/Makevars
sudo sed -i 's/CC = gcc -m64/CC = gcc64 -m64/g' /usr/lib64/R/etc/Makeconf
Even after restarting RStudio Server, I get the same output and error message.
It looks like this error is very similar to the problem here. I still don't have a solution after following those instructions, but I did find the location of my omp.h file.
/usr/lib/gcc/x86_64-amazon-linux/4.4.6/include/omp.h
/usr/lib/gcc/x86_64-amazon-linux/4.8.5/include/omp.h
/usr/lib/gcc/x86_64-amazon-linux/6.4.1/include/omp.h
I installed Developer Tools
and updated the Makeconf
file using these commands.
sudo sed -i 's/CC = gcc -m64/CC = gcc64 -m64/g' /usr/lib64/R/etc/Makeconf
sudo yum groupinstall 'Development Tools'
Then, I added these lines to the Makevars
config file.
mkdir ~/.R
vi ~/.R/Makevars
CC=gcc
VER=64
CC=gcc$(VER)
CXX=g++$(VER)
CXX11=g++$(VER)
CXX14=g++$(VER)
I restarted the RStudio Server and tried to install ModelMetrics
and received this error, the same as before.
Installing package into ‘/home/User/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ModelMetrics_1.2.2.tar.gz'
Content type 'application/x-gzip' length 16974 bytes (16 KB)
==================================================
downloaded 16 KB
* installing *source* package ‘ModelMetrics’ ...
** package ‘ModelMetrics’ successfully unpacked and MD5 sums checked
** libs
g++ -I"/opt/R/3.5.3/lib64/R/include" -DNDEBUG -I"/home/User/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -I"/opt/R/3.5.3/lib64/R/include" -DNDEBUG -I"/home/User/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I/usr/local/include -fpic -g -O2 -c auc_.cpp -o auc_.o
auc_.cpp:2:10: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
make: *** [auc_.o] Error 1
ERROR: compilation failed for package ‘ModelMetrics’
* removing ‘/home/User/R/x86_64-pc-linux-gnu-library/3.5/ModelMetrics’
Warning in install.packages :
installation of package ‘ModelMetrics’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpTSUlz4/downloaded_packages’
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
omp.h
files you found are for gcc version 7.2.1.g++
is still used instead ofg++64
. What is the output ofR CMD config CXX
?