[R-SIG-Mac] rJava compilation on R 3.5 devel

Marc Girondot marc_grt at yahoo.fr
Wed Jan 31 11:22:49 CET 2018


Dear Experts,

I use now r-3.5 devel as it is stable (from http://r.research.att.com , 
version (2018/01/30, r74185) ) but I have a problem with compilation of 
rJava package.

In short (all the explanations are bellow):

If I use clang 4.0.0 from here: http://r.research.att.com/libs/, I get 
this error: ld: library not found for -lomp

If I use clang from xcode, I get this error: clang: error: unsupported 
option '-fopenmp'

If I use clang 5.0.1, I get this error: ld: library not found for -lomp

Any idea to have rJava in r-devel ?

Thanks a lot

Marc



First I ran:

sudo R CMD javareconf

I have the Java version     : 1.8.0_162

I need to compile it from source but it failed with clang4 reporting an 
error.

I try various origin of clang:

at the beginning of the compilation, it said:

checking for gcc... /usr/local/clang4/bin/clang

I tried several version of clang:

belinda:local marcgirondot$ 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 
--version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

or (same version installed by: brew install llvm )

belinda:local marcgirondot$ 
/Applications/clang+llvm-5.0.1-final-x86_64-apple-darwin/bin/clang --version
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/clang+llvm-5.0.1-final-x86_64-apple-darwin/bin

or

belinda:local marcgirondot$ /usr/local/clang4/bin/clang --version
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /usr/local/clang4/bin

If I use the former, I get this error:
/usr/local/clang4/bin/clang -o libjri.jnilib Rengine.o jri.o 
Rcallbacks.o Rinit.o globals.o rjava.o  -dynamiclib -framework JavaVM 
-fopenmp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. 
-framework R -lpcre -llzma -lbz2 -lz -licucore -lm -liconv
ld: library not found for -lomp
clang-4.0: error: linker command failed with exit code 1 (use -v to see 
invocation)
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’

Then I tried more recent versions:

I make a symbolic link to clang 5.0.1 or the one within xcode:
cd /usr/local
sudo ln -s /Applications/clang+llvm-5.0.1-final-x86_64-apple-darwin clang4

I get this error: (after running sudo R and within R: 
install.packages("rJava")
/usr/local/clang4/bin/clang -o libjri.jnilib Rengine.o jri.o 
Rcallbacks.o Rinit.o globals.o rjava.o  -dynamiclib -framework JavaVM 
-fopenmp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. 
-framework R -lpcre -llzma -lbz2 -lz -licucore -lm -liconv
ld: library not found for -lomp
clang-5.0: error: linker command failed with exit code 1 (use -v to see 
invocation)
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’


If I make the symbolic link to
cd /usr/local
sudo ln -s 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr 
clang4

I get this error: (after running sudo R and within R: 
install.packages("rJava")
/usr/local/clang4/bin/clang -o libjri.jnilib Rengine.o jri.o 
Rcallbacks.o Rinit.o globals.o rjava.o  -dynamiclib -framework JavaVM 
-fopenmp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. 
-framework R -lpcre -llzma -lbz2 -lz -licucore -lm -liconv
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’



More information about the R-SIG-Mac mailing list