如何解决C编译器问题并在R

时间:2019-02-08 00:09:05

标签: java r

我在R中安装rJava软件包时遇到问题,我尝试了许多在线找到的解决方案,但仍然失败。以下是我的系统信息:

** macOS Mojave版本10.14;

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

**

在R Studio中,安装 rJava软件包时,出现以下错误:

clang: error: unsupported option '-fopenmp'
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Users/zoey_chen/Library/R/3.5/library/rJava’
* restoring previous ‘/Users/zoey_chen/Library/R/3.5/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status

当我尝试通过键入

解决问题时
R CMD javareconf

在终端中,我出现以下错误:

*trying to compile and link a JNI program 
detected JNI cpp flags    : - 
I/System/Library/Frameworks/JavaVM.framework/Headers
detected JNI linker flags : -framework JavaVM
x86_64-apple-darwin13.4.0-clang -I"/anaconda2/lib/R/include" - DNDEBUG -I/System/Library/Frameworks/JavaVM.framework/Headers  - D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/anaconda2/include   - fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE - fstack-protector-strong -O2 -pipe -I/anaconda2/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix  -c conftest.c -o conftest.o
conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated [-Wdeprecated-declarations]
    JNI_CreateJavaVM(0, 0, 0);
    ^
/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1937:1: note: 'JNI_CreateJavaVM' has been explicitly marked deprecated here
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
^
1 warning generated.
x86_64-apple-darwin13.4.0-clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/anaconda2/lib/R/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/anaconda2/lib -L/anaconda2/lib -o conftest.so conftest.o -framework JavaVM -L/anaconda2/lib/R/lib -lR -Wl,-framework -Wl,CoreFoundation
ld: warning: -pie being ignored. It is only used when linking a main executable
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//JavaVM.framework/JavaVM.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//JavaVM.framework/JavaVM.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd*

当我尝试通过终端安装rJava 时,它生成了以下警告:

R CMD INSTALL ~/Downloads/rJava_0.9-8.tar.gz
* installing to library ‘/Users/zoey_chen/Library/R/3.5/library’
* installing *source* package ‘rJava’ ...
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in`/private/var/folders/mh/p1pnqwj94h1_q3zllrd3xygr0000gn/T/RtmpxonVoM/R. INSTALLa5927ac76048/rJava':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘rJava’
* removing ‘/Users/zoey_chen/Library/R/3.5/library/rJava’
* restoring previous ‘/Users/zoey_chen/Library/R/3.5/library/rJava’

我只想安装rJava软件包。有解决方案吗?

0 个答案:

没有答案