致命错误:auc_.cpp:2:10:致命错误:omp.h:没有这样的文件或目录 [英] Fatal error: auc_.cpp:2:10: fatal error: omp.h: No such file or directory
问题描述
我正在AWS的Linux机器上运行RServer Studio.
I'm running RServer Studio on a Linux box on AWS.
我尝试安装ModelMetrics
(caret
的依赖项),并收到此错误:
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’
这是完整的输出消息
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
即使重新启动RStudio服务器之后,我也会得到相同的输出和错误消息.
Even after restarting RStudio Server, I get the same output and error message.
此错误看起来与这里的问题.遵循这些说明后,我仍然没有解决方案,但是我确实找到了omp.h文件的位置.
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
我安装了Developer Tools
并使用这些命令更新了Makeconf
文件.
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'
然后,我将这些行添加到Makevars
配置文件中.
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)
我重新启动了RStudio服务器,并尝试安装ModelMetrics
并收到此错误,与以前相同.
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’
推荐答案
事实证明,Linux机器上的gcc
版本存在问题.
It turns out that there was something wrong with the version of gcc
on the linux box.
按照此处的说明,我可以通过这两行代码.
Per the instructions here, I was able to fix the problem with these two lines of code.
sudo yum remove gcc72-c++.x86_64 libgcc72.x86_64
sudo yum groupinstall 'Development Tools'
这篇关于致命错误:auc_.cpp:2:10:致命错误:omp.h:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!